From f4a8791a9cafc0267ddb88e36269eaa92cdf27a6 Mon Sep 17 00:00:00 2001 From: Fredrik Valeur Date: Tue, 24 Jul 2012 12:00:35 -0700 Subject: [PATCH] Merge in nested parameters support and backport to ruby 1.8 hash syntax --- Gemfile.lock | 8 ++++---- lib/strong_parameters/version.rb | 2 +- test/nested_parameters_test.rb | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 148a5b0..fa69bd5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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 diff --git a/lib/strong_parameters/version.rb b/lib/strong_parameters/version.rb index 61ecd5f..ff8dc05 100644 --- a/lib/strong_parameters/version.rb +++ b/lib/strong_parameters/version.rb @@ -1,3 +1,3 @@ module StrongParameters - VERSION = "0.1.3.af1" + VERSION = "0.1.3.af4" end diff --git a/test/nested_parameters_test.rb b/test/nested_parameters_test.rb index 1975e97..9a880a4 100644 --- a/test/nested_parameters_test.rb +++ b/test/nested_parameters_test.rb @@ -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']