Module: MuckUsers::Models::MuckUser::ClassMethods
- Defined in:
- lib/muck-users/models/user.rb
Instance Method Summary collapse
- #activate_all ⇒ Object
-
#email_exists?(email) ⇒ Boolean
checks to see if a given email is already in the database.
- #inactive_count ⇒ Object
-
#login_exists?(login) ⇒ Boolean
checks to see if a given login is already in the database.
- #parse_name(name) ⇒ Object
- #validates_terms_of_service ⇒ Object
Instance Method Details
#activate_all ⇒ Object
53 54 55 |
# File 'lib/muck-users/models/user.rb', line 53 def activate_all self.update_all("activated_at = '#{Time.now}'", 'activated_at IS NULL') end |
#email_exists?(email) ⇒ Boolean
checks to see if a given email is already in the database
67 68 69 70 71 72 73 |
# File 'lib/muck-users/models/user.rb', line 67 def email_exists?(email) if self.find_by_email(email).nil? false else true end end |
#inactive_count ⇒ Object
49 50 51 |
# File 'lib/muck-users/models/user.rb', line 49 def inactive_count self.inactive.count end |
#login_exists?(login) ⇒ Boolean
checks to see if a given login is already in the database
58 59 60 61 62 63 64 |
# File 'lib/muck-users/models/user.rb', line 58 def login_exists?(login) if self.find_by_login(login).nil? false else true end end |
#parse_name(name) ⇒ Object
79 80 81 82 83 84 85 |
# File 'lib/muck-users/models/user.rb', line 79 def parse_name(name) return '' if name.blank? names = name.split(' ') return '' if names.length <= 0 return [names[0], names[0]] if names.length == 1 [names[0], names.slice(1, names.length).join(' ')] end |
#validates_terms_of_service ⇒ Object
75 76 77 |
# File 'lib/muck-users/models/user.rb', line 75 def validates_terms_of_service validate(:accepts_terms_of_service?, :on => :create) end |