Module: ActiveRecord::Serialization

Defined in:
lib/ruboss4ruby/active_foo.rb,
lib/ruboss4ruby/active_record_default_methods.rb

Overview

Flex friendly XML serialization patches

Instance Method Summary collapse

Instance Method Details

#json_defaults_old_to_jsonObject



31
# File 'lib/ruboss4ruby/active_record_default_methods.rb', line 31

alias_method :json_defaults_old_to_json, :to_json

#to_fxml(options = {}, &block) ⇒ Object



108
109
110
111
112
113
# File 'lib/ruboss4ruby/active_foo.rb', line 108

def to_fxml(options = {}, &block)
  options.merge!(:dasherize => false)
  default_except = [:crypted_password, :salt, :remember_token, :remember_token_expires_at]
  options[:except] = (options[:except] ? options[:except] + default_except : default_except)
  to_xml(options, &block)
end

#to_json(options = {}, &block) ⇒ Object



42
43
44
45
46
47
48
49
# File 'lib/ruboss4ruby/active_record_default_methods.rb', line 42

def to_json(options = {}, &block)
  unless options[:ignore_defaults]
    unless options[:ignore_default_methods]
      options[:methods] = [options[:methods] || []].flatten + (self.class.defaults_hash[:methods] || [])
    end
  end
  json_defaults_old_to_json(options, &block)      
end

#to_xml(options = {}, &block) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/ruboss4ruby/active_record_default_methods.rb', line 33

def to_xml(options = {}, &block)
  unless options[:ignore_defaults]
    unless options[:ignore_default_methods]
      options[:methods] = [options[:methods] || []].flatten + (self.class.defaults_hash[:methods] || [])
    end
  end
  xml_defaults_old_to_xml(options, &block)
end

#xml_defaults_old_to_xmlObject



29
# File 'lib/ruboss4ruby/active_record_default_methods.rb', line 29

alias_method :xml_defaults_old_to_xml, :to_xml