Fixing as_json to always use a simple Hash and remove nils. History updates.
This commit is contained in:
parent
a284c65992
commit
1ef25c5015
3 changed files with 33 additions and 0 deletions
|
@ -12,6 +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)
|
||||
end
|
||||
|
||||
# Returns the Class properties
|
||||
#
|
||||
# ==== Returns
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue