Created
December 12, 2010 21:58
-
-
Save olistik/738376 to your computer and use it in GitHub Desktop.
How to use OpenHash in Rails 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## UPDATE 2010-12-14: facets-2.9.0 and hashery-1.3.0 doesn't work with rails 3.0.3 (due to a bug of facets): | |
| ## https://github.com/rubyworks/hashery/issues#issue/6 | |
| ## https://github.com/rubyworks/facets/issues/issue/31 | |
| ## in your Gemfile | |
| gem "facets" | |
| gem "hashery" | |
| ## then execute in the shell | |
| bundle install | |
| ## test it | |
| $ rails console | |
| Loading development environment (Rails 3.0.3) | |
| ruby-1.9.2-p0 > OpenHash | |
| => OpenHash | |
| ruby-1.9.2-p0 > movie = OpenHash.new | |
| => {} | |
| ruby-1.9.2-p0 > movie.director = "Steven Spielberg" | |
| => "Steven Spielberg" | |
| ruby-1.9.2-p0 > movie.director | |
| => "Steven Spielberg" | |
| ruby-1.9.2-p0 > movie[:director] | |
| => "Steven Spielberg" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment