Callbacks
jaywhiting opened this issue · 4 comments
jaywhiting commented
The callback script is not just wrapped around the outside "curly brackets" but inside them as well after ever "do" call. This is causing an "unexpected token" error.
dewski commented
Which version of json_builder are you using? Do you have an example json_builder view for me to reproduce this error?
Thanks!
jaywhiting commented
dogfights @recent_dogfights do |dogfight|
id dogfight.id
content dogfight.content
options dogfight.options
url dogfight_url(dogfight.id)
created_at dogfight.created_at
author dogfight.user do |user|
id user.id
name switch_name(user)
url user_url(user)
avatar_url user.avatar.url
end
end
Which is giving me:
unexpected token at 'callback({"id": 79, "content": "Most recent dogfight!", "options": ["For", "Against"], "url": "http://localhost:3000/dogfights/79", "created_at": "2011-12-20T14:33:25Z", "author": callback({"id": 2, "name": "Johnny Cash", "url": "http://localhost:3000/randomizor222", "avatar_url": "http://barkles.com/assets/barkles_thumb.png"})})]}'
I am using the latest version (3.0.3)
dewski commented
This is a duplicate of issue #12. I just pushed up 3.0.4, can you confirm this fixed it?
jaywhiting commented
Confirmed, thanks!