From 81f92cbc2b4c1f99c08d04a8a360efe64a12faf8 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Fri, 4 May 2012 16:51:17 -0300 Subject: Use Hash#fetch instead of has_key? check --- actionpack/lib/action_controller/metal/params_wrapper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib') 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? -- cgit v1.2.3