Class: User
- Inherits:
-
Object
- Object
- User
- Extended by:
- Dragonfly::ActiveModelExtensions
- Includes:
- Canable::Cans, MongoMapper::Document
- Defined in:
- app/models/user.rb
Class Method Summary collapse
-
.find_for_authentication(conditions) ⇒ Object
Make emails for login case insensitive.
Instance Method Summary collapse
Class Method Details
.find_for_authentication(conditions) ⇒ Object
Make emails for login case insensitive
51 52 53 54 55 |
# File 'app/models/user.rb', line 51 def self.find_for_authentication(conditions) filter_auth_params(conditions) # Search using case sensitive stripped email first(conditions.merge(:email => /^#{Regexp.escape(conditions[:email].strip)}$/i)) end |
Instance Method Details
#admin? ⇒ Boolean
41 42 43 |
# File 'app/models/user.rb', line 41 def admin? .include?('admin') end |
#editor? ⇒ Boolean
45 46 47 48 |
# File 'app/models/user.rb', line 45 def editor? return true if self.class.editor_groups.blank? (self.class.editor_groups & ).size > 0 end |
#full_name ⇒ Object
37 38 39 |
# File 'app/models/user.rb', line 37 def full_name name || email end |
#web_image_extension ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'app/models/user.rb', line 57 def web_image_extension # If the extension id anything other than a png or gif then it should be a jpg case avatar_ext when 'png', 'gif' avatar_ext else 'jpg' end.to_sym end |