bjornmelgaard bjornmelgaard - 1 month ago 20
JSON Question

Counting in JBuilder throw exception

json.votes answer, answer.votes.count
throw
0 is not a symbol nor a string


Also try
json.votes answer, answer.votes.count.to_s
throw
undefined method '0' for #<Answer:0x00000004699a98>


Application code

Answer

Try json.votes answer.votes.count