Skip to content

Commit

Permalink
Merge pull request rails#14 from pctj101/master
Browse files Browse the repository at this point in the history
Updated README.md to talk about needing Ruby 1.9 block local variables.
  • Loading branch information
dhh committed Mar 23, 2012
2 parents 1339784 + 478c163 commit 5e53fbf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,21 @@ Libraries similar to this in some form or another include:
* JSON Builder: https://github.com/dewski/json_builder
* Jsonify: https://github.com/bsiggelkow/jsonify
* RepresentationView: https://github.com/mdub/representative_view

Compatibility Notes
===================

Jbuilder works best with Ruby 1.9. It does not work so well with Ruby 1.8.

Jbuilder leverages "block local variables" found in Ruby 1.9. So when you
write code like:

``` ruby
json.author do |json|
# notice json variable in here
json.name @message.creator.name.familiar
end
```

The issue is that the "inner" json in the block overwrites the parent and
causes strange looking issues to appear.

0 comments on commit 5e53fbf

Please sign in to comment.