Closed kethomassen closed 8 years ago
Put .to_a
after .all
. Also override as_json
instead.
If you override as_json
you shouldn't need to_a
@nviennot
/site/models/item.rb:13:in `as_json': wrong number of arguments (1 for 0) (ArgumentError)
when using
def as_json
{
:id => id,
:image => price.image,
:price => price.latest_price,
:name => price.name
}.to_json
end
def as_json(options={})
And you should not call to_json, just return a hash
Thanks! @nviennot
Is there a way to override
to_json
like this as such? Would be convenient!