bjornmelgaard bjornmelgaard - 13 days ago 6
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