You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lets say we have a nested comment tree (think discussion forum)
Let say we have a file:
index.json.jbuilder
json.comments @comments do |json, comment|
json.partial! "example/comment", :comment => comment
end
Then we have _comment.json.jbilder
json.id comment.id
json.comment comment.text
json.replies comment.replies do |json, reply|
logger.info "Hello" # this prints
json.partial! "example/comment", :comment => reply # this is where we go "recursive"
logger.info "World" # program never makes it this far
end
The text was updated successfully, but these errors were encountered:
Ruby 1.8 doesn't have block local variables, so if you use json as a variable name inside the block it will overwrite the parent instance - just been burnt by this myself. :-)
Using ree 1.8.7 w/ jbuilder+patches from #4
Lets say we have a nested comment tree (think discussion forum)
Let say we have a file:
index.json.jbuilder
json.comments @comments do |json, comment|
json.partial! "example/comment", :comment => comment
end
Then we have _comment.json.jbilder
json.id comment.id
json.comment comment.text
json.replies comment.replies do |json, reply|
logger.info "Hello" # this prints
json.partial! "example/comment", :comment => reply # this is where we go "recursive"
logger.info "World" # program never makes it this far
end
The text was updated successfully, but these errors were encountered: