Permalink
Browse files

Use Hash#fetch instead of has_key? check

  • Loading branch information...
1 parent 7a09360 commit 81f92cbc2b4c1f99c08d04a8a360efe64a12faf8 @carlosantoniodasilva carlosantoniodasilva committed May 4, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 actionpack/lib/action_controller/metal/params_wrapper.rb
@@ -166,7 +166,7 @@ def _set_wrapper_defaults(options, model=nil)
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?

0 comments on commit 81f92cb

Please sign in to comment.