module Her::Model::ORM::SerializationMethods

Public Instance Methods

hash() click to toggle source

Delegate to @data, allowing models to act correctly in code like:

[ Model.find(1), Model.find(1) ].uniq # => [ Model.find(1) ]
# File lib/her/model/orm/serialization_methods.rb, line 9
def hash
  @data.hash
end
to_params() click to toggle source

Convert into a hash of request parameters

@example

@user.to_params
# => { id: 1, name: 'John Smith' }
# File lib/her/model/orm/serialization_methods.rb, line 18
def to_params
  if self.class.include_root_in_json
    { (self.class.include_root_in_json == true ? self.class.root_element : self.class.include_root_in_json) => @data.dup }
  else
    @data.dup
  end
end