Module: DeviseMeteor::MeteorUserModel
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/devise_meteor/concerns/meteor_user_model.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#after_confirmation ⇒ Object
called by devise after confirmation is set.
- #meteor_get_hash_by_email(given_mail) ⇒ Object
- #name ⇒ Object
- #name=(name) ⇒ Object
- #username ⇒ Object
- #username=(username) ⇒ Object
Instance Method Details
#after_confirmation ⇒ Object
called by devise after confirmation is set
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/devise_meteor/concerns/meteor_user_model.rb', line 54 def after_confirmation emails_temp = emails # we have to do this, by pop and re-adding because # MongoDb does not save when update within a nested array when is called by $set # So we pop our email out and overwrite the array completely # This approach does not work like expected which should update AND PERSIST, which does not work # User.where("emails.address" => email) # .set('emails.$.verified': true) hash = emails.pop { |m| m[:address] == email } hash[:verified] = true emails_temp << hash set(emails: emails_temp) end |
#meteor_get_hash_by_email(given_mail) ⇒ Object
48 49 50 51 |
# File 'lib/devise_meteor/concerns/meteor_user_model.rb', line 48 def meteor_get_hash_by_email(given_mail) used_mail = given_mail.nil? ? email : given_mail emails.detect { |mail| mail[:address] == used_mail } end |
#name ⇒ Object
32 33 34 |
# File 'lib/devise_meteor/concerns/meteor_user_model.rb', line 32 def name profile.name end |
#name=(name) ⇒ Object
36 37 38 |
# File 'lib/devise_meteor/concerns/meteor_user_model.rb', line 36 def name=(name) profile.update_attribute(:name, name) end |
#username ⇒ Object
40 41 42 |
# File 'lib/devise_meteor/concerns/meteor_user_model.rb', line 40 def username profile.username end |
#username=(username) ⇒ Object
44 45 46 |
# File 'lib/devise_meteor/concerns/meteor_user_model.rb', line 44 def username=(username) profile.update_attribute(:username, username) end |