diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-05-01 18:31:33 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-05-01 18:31:33 -0700 |
commit | b3a74a14a3d6efa22a07116c4cb26aadc479fb41 (patch) | |
tree | f5e7fe3933183c796cf82d2bada32417eb0b65e8 /activemodel/lib/active_model/errors.rb | |
parent | dd1f36078eff18721eed76d236796c8d26d81e58 (diff) | |
parent | eebb9ddf9ba559a510975c486fe59a4edc9da97d (diff) | |
download | rails-b3a74a14a3d6efa22a07116c4cb26aadc479fb41.tar.gz rails-b3a74a14a3d6efa22a07116c4cb26aadc479fb41.tar.bz2 rails-b3a74a14a3d6efa22a07116c4cb26aadc479fb41.zip |
Merge pull request #10408 from patricksrobertson/convert_activemodel_to_new_hash_syntax
Convert ActiveModel to 1.9 hash syntax.
Diffstat (limited to 'activemodel/lib/active_model/errors.rb')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index b60458b3c6..0d7efab04b 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -231,7 +231,7 @@ module ActiveModel # # <error>name must be specified</error> # # </errors> def to_xml(options={}) - to_a.to_xml({ :root => "errors", :skip_types => true }.merge!(options)) + to_a.to_xml({ root: "errors", skip_types: true }.merge!(options)) end # Returns a Hash that can be used as the JSON representation for this @@ -370,11 +370,11 @@ module ActiveModel def full_message(attribute, message) return message if attribute == :base attr_name = attribute.to_s.tr('.', '_').humanize - attr_name = @base.class.human_attribute_name(attribute, :default => attr_name) + attr_name = @base.class.human_attribute_name(attribute, default: attr_name) I18n.t(:"errors.format", { - :default => "%{attribute} %{message}", - :attribute => attr_name, - :message => message + default: "%{attribute} %{message}", + attribute: attr_name, + message: message }) end @@ -426,10 +426,10 @@ module ActiveModel value = (attribute != :base ? @base.send(:read_attribute_for_validation, attribute) : nil) options = { - :default => defaults, - :model => @base.class.model_name.human, - :attribute => @base.class.human_attribute_name(attribute), - :value => value + default: defaults, + model: @base.class.model_name.human, + attribute: @base.class.human_attribute_name(attribute), + value: value }.merge!(options) I18n.translate(key, options) |