Skip to content

Commit

Permalink
Merge in nested parameters support and backport to ruby 1.8 hash syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
fvaleur committed Jul 24, 2012
1 parent 3f3acef commit f4a8791
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
strong_parameters (0.1.3)
strong_parameters (0.1.3.af4)
actionpack (>= 3.1.6)
activemodel (>= 3.1.6)
railties (>= 3.1.6)
Expand Down Expand Up @@ -45,15 +45,15 @@ GEM
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
thor (< 2.0, >= 0.14.6)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
thor (0.15.3)
tilt (!= 1.3.0, ~> 1.1)
thor (0.15.4)
tilt (1.3.3)

PLATFORMS
Expand Down
2 changes: 1 addition & 1 deletion lib/strong_parameters/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module StrongParameters
VERSION = "0.1.3.af1"
VERSION = "0.1.3.af4"
end
10 changes: 5 additions & 5 deletions test/nested_parameters_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ class NestedParametersTest < ActiveSupport::TestCase

test "fields_for_style_nested_params" do
params = ActionController::Parameters.new({
book: {
authors_attributes: {
:'0' => { name: 'William Shakespeare', age_of_death: '52' },
:'1' => { name: 'Unattributed Assistant' }
:book => {
:authors_attributes => {
:'0' => {:name => 'William Shakespeare', :age_of_death => '52' },
:'1' => { :name => 'Unattributed Assistant' }
}
}
})
permitted = params.permit book: { authors_attributes: [ :name ] }
permitted = params.permit :book => { :authors_attributes => [ :name ] }

assert_not_nil permitted[:book][:authors_attributes]['0']
assert_not_nil permitted[:book][:authors_attributes]['1']
Expand Down

0 comments on commit f4a8791

Please sign in to comment.