diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-05-04 16:51:17 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-05-04 16:51:17 -0300 |
commit | 81f92cbc2b4c1f99c08d04a8a360efe64a12faf8 (patch) | |
tree | b42ee964899468a3859da811bb18e277e4ccbd53 | |
parent | 7a093606f662cda2de597d81dde974ecbe375701 (diff) | |
download | rails-81f92cbc2b4c1f99c08d04a8a360efe64a12faf8.tar.gz rails-81f92cbc2b4c1f99c08d04a8a360efe64a12faf8.tar.bz2 rails-81f92cbc2b4c1f99c08d04a8a360efe64a12faf8.zip |
Use Hash#fetch instead of has_key? check
-rw-r--r-- | actionpack/lib/action_controller/metal/params_wrapper.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/params_wrapper.rb b/actionpack/lib/action_controller/metal/params_wrapper.rb index fc8a8c9dcd..1f52c164de 100644 --- a/actionpack/lib/action_controller/metal/params_wrapper.rb +++ b/actionpack/lib/action_controller/metal/params_wrapper.rb @@ -166,7 +166,7 @@ module ActionController unless options[:include] || options[:exclude] model ||= _default_wrap_model - role = options.has_key?(:as) ? options[:as] : :default + role = options.fetch(:as, :default) if model.respond_to?(:accessible_attributes) && model.accessible_attributes(role).present? options[:include] = model.accessible_attributes(role).to_a elsif model.respond_to?(:attribute_names) && model.attribute_names.present? |