diff options
author | Petteri Räty <petsku@petteriraty.eu> | 2011-08-01 17:35:02 +0300 |
---|---|---|
committer | Petteri Räty <petsku@petteriraty.eu> | 2011-08-01 17:35:02 +0300 |
commit | 4f32847c92654f3e8b9e8a0569872cdc1336e537 (patch) | |
tree | d83748c6285828e3c6b089c4d2523ac991362ccd /site/app/models/user.rb | |
parent | Show use hints for users (diff) | |
parent | Add and cleanup validations (diff) | |
download | council-webapp-4f32847c92654f3e8b9e8a0569872cdc1336e537.tar.gz council-webapp-4f32847c92654f3e8b9e8a0569872cdc1336e537.tar.bz2 council-webapp-4f32847c92654f3e8b9e8a0569872cdc1336e537.zip |
Merge remote-tracking branch 'github/review'
Diffstat (limited to 'site/app/models/user.rb')
-rw-r--r-- | site/app/models/user.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/site/app/models/user.rb b/site/app/models/user.rb index bba0a6e..cbcd021 100644 --- a/site/app/models/user.rb +++ b/site/app/models/user.rb @@ -12,6 +12,10 @@ class User < ActiveRecord::Base end has_many :votes + + validates_presence_of :name, :irc_nick, :email + validates_uniqueness_of :name, :irc_nick, :email + # --- Signup lifecycle --- # lifecycle do @@ -62,15 +66,14 @@ class User < ActiveRecord::Base return 'There were no meetings in this term yet' if agendas.count.zero? for agenda in agendas - if Participation.participant_is(self).agenda_is(agenda).count == 0 + if Participation.participant_is(self).agenda_is(agenda).count.zero? num_status += 1 if num_status < 3 else num_status = 0 if num_status == 1 end end - text_statuses = ['Was on last meeting', 'Skipped last meeting', - 'Slacker', 'No more a council'] + text_statuses = ['Was on last meeting', 'Skipped last meeting', 'Slacker', 'No more a council'] text_statuses[num_status] end |