Module: Devise::Models::Serializable

Extended by:
ActiveSupport::Concern
Defined in:
lib/devise/orm/data_mapper/serializable.rb

Overview

This module redefines properties_to_serialize in models for more secure defaults. By default, it removes from the serializable model all attributes whose writer or reader is not public. You can remove this default by using :force_except 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.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#properties_to_serialize(options = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/devise/orm/data_mapper/serializable.rb', line 12

def properties_to_serialize(options=nil)
  options ||= {}
  if options.key?(:force_except) || options.key?(:force_exclude)
    options[:exclude] = options.delete(:force_except) || options.delete(:force_exclude)
    super(options)
  else
    except = Array(options[:exclude]) + Array(options[:except])
    super(options.merge(:exclude => except + self.class.blacklist_keys))
  end
end

#to_xml(*args) ⇒ Object

Get back to DataMapper’s #to_xml.



24
25
26
# File 'lib/devise/orm/data_mapper/serializable.rb', line 24

def to_xml(*args)
  super
end