Module: CouchPotato::Persistence::Json::ClassMethods

Defined in:
lib/couch_potato/persistence/json.rb

Instance Method Summary collapse

Instance Method Details

#json_create(json) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/couch_potato/persistence/json.rb', line 29

def json_create(json)
  instance = self.new
  instance._id = json[:_id] || json['_id']
  instance._rev = json[:_rev] || json['_rev']
  properties.each do |property|
    property.build(instance, json)
  end
  instance
end