updating to couchrest 1.1.2 and as_couch_json method
This commit is contained in:
parent
9d724aee47
commit
3258ac22e9
4 changed files with 22 additions and 6 deletions
|
@ -12,8 +12,10 @@ module CouchRest
|
|||
raise "You can only mixin Properties in a class responding to [] and []=, if you tried to mixin CastedModel, make sure your class inherits from Hash or responds to the proper methods" unless (method_defined?(:[]) && method_defined?(:[]=))
|
||||
end
|
||||
|
||||
def as_json(options = nil)
|
||||
Hash[self].reject{|k,v| v.nil?}.as_json(options)
|
||||
# Provide an attribute hash ready to be sent to CouchDB but with
|
||||
# all the nil attributes removed.
|
||||
def as_couch_json
|
||||
super.delete_if{|k,v| v.nil?}
|
||||
end
|
||||
|
||||
# Returns the Class properties with their values
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue