diff options
author | Maxim Filimonov <tpaktopsp@gmail.com> | 2014-06-02 08:39:13 -0700 |
---|---|---|
committer | dblock <dblock@dblock.org> | 2014-06-02 08:39:13 -0700 |
commit | 41e6c676e15bc4c8333202bd49373c88ec1129f6 (patch) | |
tree | 476039afc28ce4b9bf1626766ac068ce67bc4abc | |
parent | 80a8f11a7833bcfede7245ab78e9c05d49f99ed7 (diff) | |
download | hashie-41e6c676e15bc4c8333202bd49373c88ec1129f6.tar.gz |
Documented hashie_rails.
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | UPGRADING.md | 12 |
2 files changed, 6 insertions, 16 deletions
@@ -236,15 +236,7 @@ p.trick # => NoMethodError ### Mash and Rails 4 Strong Parameters -If you're using [Rails 4 strong parameters](http://edgeguides.rubyonrails.org/action_controller_overview.html#strong-parameters), you will get a [ForbiddenAttributesProtection](https://github.com/rails/strong_parameters/blob/master/lib/active_model/forbidden_attributes_protection.rb) exceptions when mass-assigning attributes. - -To allow mass assignment, add the following initializer in config/initializers/mash.rb. This prevents Mash from responding to `:permitted?` and therefore triggering this behavior in [ForbiddenAttributesProtection](https://github.com/rails/strong_parameters/blob/master/lib/active_model/forbidden_attributes_protection.rb). - -```ruby -class Mash - include Hashie::Extensions::Mash::ActiveModel -end -``` +To enable compatibility with Rails 4 use the ['hashie\_rails' gem](http://rubygems.org/gems/hashie_rails). ## Trash diff --git a/UPGRADING.md b/UPGRADING.md index 2d20ae8..8d9de59 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -5,17 +5,15 @@ Upgrading Hashie #### Compatibility with Rails 4 Strong Parameters -Version 2.1 introduced support to prevent default Rails 4 mass-assignment protection behavior. This was [issue #89](https://github.com/intridea/hashie/issues/89), resolved in [#104](https://github.com/intridea/hashie/pull/104). In version 2.2 this behavior has been removed in [#147](https://github.com/intridea/hashie/pull/147) in favor of a mixin. +Version 2.1 introduced support to prevent default Rails 4 mass-assignment protection behavior. This was [issue #89](https://github.com/intridea/hashie/issues/89), resolved in [#104](https://github.com/intridea/hashie/pull/104). In version 2.2 this behavior has been removed in [#147](https://github.com/intridea/hashie/pull/147) in favor of a mixin and extracted into a separate gem in 3.0. -To enable 2.1 compatible behavior, add the following initializer in config/initializers/mash.rb. This prevents Mash from responding to `:permitted?` and therefore triggering this behavior in [ForbiddenAttributesProtection](https://github.com/rails/strong_parameters/blob/master/lib/active_model/forbidden_attributes_protection.rb). +To enable 2.1 compatible behavior, use the ['hashie\_rails' gem](http://rubygems.org/gems/hashie_rails). -```ruby -class Mash - include Hashie::Extensions::Mash::ActiveModel -end +```bash +gem 'hashie_rails' ``` -See [Mash and Rails 4 Strong Parameters](README.md#mash-and-rails-4-strong-parameters) for more details. +See [#154](https://github.com/intridea/hashie/pull/154) and [Mash and Rails 4 Strong Parameters](README.md#mash-and-rails-4-strong-parameters) for more details. #### Key Conversions in Hashie::Dash and Hashie::Trash |