diff options
author | Xavier Noria <fxn@hashref.com> | 2016-08-06 19:44:11 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2016-08-06 19:44:11 +0200 |
commit | 411ccbdab2608c62aabdb320d52cb02d446bb39c (patch) | |
tree | 05671553ac2a23dd1db4d11949c1ac43c3dd1367 /activemodel | |
parent | 60b67d76dc1d98e4269aac7705e9d8323eb42942 (diff) | |
download | rails-411ccbdab2608c62aabdb320d52cb02d446bb39c.tar.gz rails-411ccbdab2608c62aabdb320d52cb02d446bb39c.tar.bz2 rails-411ccbdab2608c62aabdb320d52cb02d446bb39c.zip |
remove redundant curlies from hash arguments
Diffstat (limited to 'activemodel')
4 files changed, 7 insertions, 11 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index 2468ebb6e6..0cdb0e8525 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -439,11 +439,9 @@ module ActiveModel return message if attribute == :base attr_name = attribute.to_s.tr(".", "_").humanize attr_name = @base.class.human_attribute_name(attribute, default: attr_name) - I18n.t(:"errors.format", { - default: "%{attribute} %{message}", + I18n.t(:"errors.format", default: "%{attribute} %{message}", attribute: attr_name, - message: message - }) + message: message) end # Translates an error message in its default scope diff --git a/activemodel/test/cases/forbidden_attributes_protection_test.rb b/activemodel/test/cases/forbidden_attributes_protection_test.rb index af61a566cb..fdd349a0fb 100644 --- a/activemodel/test/cases/forbidden_attributes_protection_test.rb +++ b/activemodel/test/cases/forbidden_attributes_protection_test.rb @@ -25,14 +25,14 @@ end class ActiveModelMassUpdateProtectionTest < ActiveSupport::TestCase test "forbidden attributes cannot be used for mass updating" do - params = ProtectedParams.new({ "a" => "b" }) + params = ProtectedParams.new("a" => "b") assert_raises(ActiveModel::ForbiddenAttributesError) do Account.new.sanitize_for_mass_assignment(params) end end test "permitted attributes can be used for mass updating" do - params = ProtectedParams.new({ "a" => "b" }).permit! + params = ProtectedParams.new("a" => "b").permit! assert_equal({ "a" => "b" }, Account.new.sanitize_for_mass_assignment(params)) end diff --git a/activemodel/test/cases/type/integer_test.rb b/activemodel/test/cases/type/integer_test.rb index 0fa7a12de0..e00246b602 100644 --- a/activemodel/test/cases/type/integer_test.rb +++ b/activemodel/test/cases/type/integer_test.rb @@ -20,7 +20,7 @@ module ActiveModel test "random objects cast to nil" do type = Type::Integer.new assert_nil type.cast([1,2]) - assert_nil type.cast({1 => 2}) + assert_nil type.cast(1 => 2) assert_nil type.cast(1..2) end diff --git a/activemodel/test/cases/validations/confirmation_validation_test.rb b/activemodel/test/cases/validations/confirmation_validation_test.rb index 9ce3955a89..b1c4d42065 100644 --- a/activemodel/test/cases/validations/confirmation_validation_test.rb +++ b/activemodel/test/cases/validations/confirmation_validation_test.rb @@ -56,10 +56,8 @@ class ConfirmationValidationTest < ActiveModel::TestCase @old_load_path, @old_backend = I18n.load_path.dup, I18n.backend I18n.load_path.clear I18n.backend = I18n::Backend::Simple.new - I18n.backend.store_translations("en", { - errors: { messages: { confirmation: "doesn't match %{attribute}" } }, - activemodel: { attributes: { topic: { title: "Test Title"} } } - }) + I18n.backend.store_translations("en", errors: { messages: { confirmation: "doesn't match %{attribute}" } }, + activemodel: { attributes: { topic: { title: "Test Title"} } }) Topic.validates_confirmation_of(:title) |