标签: ruby-on-rails json jbuilder
json.votes answer, answer.votes.count抛出0 is not a symbol nor a string
json.votes answer, answer.votes.count
0 is not a symbol nor a string
也试试 json.votes answer, answer.votes.count.to_s抛出undefined method '0' for #<Answer:0x00000004699a98>
json.votes answer, answer.votes.count.to_s
undefined method '0' for #<Answer:0x00000004699a98>
Application code
答案 0 :(得分:2)
尝试json.votes answer.votes.count
json.votes answer.votes.count