Permalink
Browse files

Merge pull request #14 from pctj101/master

Updated README.md to talk about needing Ruby 1.9 block local variables.
  • Loading branch information...
2 parents 1339784 + 478c163 commit 5e53fbfb82053d78cefa1b598894259d253268ba @dhh dhh committed Mar 23, 2012
Showing with 18 additions and 0 deletions.
  1. +18 −0 README.md
View
@@ -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.