Module: Devise::Orm::DataMapper::Compatibility
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/devise/orm/data_mapper/compatibility.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #assign_attributes(params, *options) ⇒ Object
- #changed? ⇒ Boolean
- #email_changed? ⇒ Boolean
- #email_was ⇒ Object
- #encrypted_password_changed? ⇒ Boolean
- #invalid? ⇒ Boolean
-
#properties_to_serialize(options = nil) ⇒ Object
Redefine properties_to_serialize in models for more secure defaults.
- #save(options = nil) ⇒ Object
- #update_attribute(name, value) ⇒ Object
- #update_attributes(*args) ⇒ Object
Instance Method Details
#assign_attributes(params, *options) ⇒ Object
56 57 58 |
# File 'lib/devise/orm/data_mapper/compatibility.rb', line 56 def assign_attributes(params, *) self.attributes = params end |
#changed? ⇒ Boolean
36 37 38 |
# File 'lib/devise/orm/data_mapper/compatibility.rb', line 36 def changed? dirty? end |
#email_changed? ⇒ Boolean
64 65 66 |
# File 'lib/devise/orm/data_mapper/compatibility.rb', line 64 def email_changed? attribute_dirty?(:email) && self.email.present? end |
#email_was ⇒ Object
72 73 74 |
# File 'lib/devise/orm/data_mapper/compatibility.rb', line 72 def email_was original_attributes[:email] end |
#encrypted_password_changed? ⇒ Boolean
68 69 70 |
# File 'lib/devise/orm/data_mapper/compatibility.rb', line 68 def encrypted_password_changed? attribute_dirty?(:email) && self.encrypted_password.present? end |
#invalid? ⇒ Boolean
60 61 62 |
# File 'lib/devise/orm/data_mapper/compatibility.rb', line 60 def invalid? !valid? end |
#properties_to_serialize(options = nil) ⇒ Object
Redefine properties_to_serialize in models for more secure defaults. By default, it removes from the serializable model all attributes that are not accessible. You can remove this default by using :force_exclude and passing a new list of attributes you want to exempt. All attributes given to :exclude will simply add names to exempt to Devise internal list.
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/devise/orm/data_mapper/compatibility.rb', line 81 def properties_to_serialize(=nil) ||= {} if .key?(:force_except) || .key?(:force_exclude) [:exclude] = .delete(:force_except) || .delete(:force_exclude) super() else blacklist = Devise::Models::Authenticatable.const_defined?(:BLACKLIST_FOR_SERIALIZATION) ? Devise::Models::Authenticatable::BLACKLIST_FOR_SERIALIZATION : [] except = Array([:exclude]) + Array([:except]) + blacklist super(.merge(:exclude => except)) end end |
#save(options = nil) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/devise/orm/data_mapper/compatibility.rb', line 40 def save(=nil) if .is_a?(Hash) && [:validate] == false _persist else super() end end |
#update_attribute(name, value) ⇒ Object
48 49 50 |
# File 'lib/devise/orm/data_mapper/compatibility.rb', line 48 def update_attribute(name, value) update(name => value) end |
#update_attributes(*args) ⇒ Object
52 53 54 |
# File 'lib/devise/orm/data_mapper/compatibility.rb', line 52 def update_attributes(*args) update(*args) end |