From d77b306b63e20aabec5daf7159d31c8ee31492c9 Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Sun, 15 May 2011 14:25:00 -0400 Subject: Make ParamsWrapper calling newly introduced `Model.attribute_names` instead of `.column_names` --- actionpack/lib/action_controller/metal/params_wrapper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (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 b18be60201..aa7c1e09c2 100644 --- a/actionpack/lib/action_controller/metal/params_wrapper.rb +++ b/actionpack/lib/action_controller/metal/params_wrapper.rb @@ -145,7 +145,7 @@ module ActionController begin model_klass = model_name.constantize rescue NameError, ArgumentError => e - if e.message =~ /is not missing constant|uninitialized constant #{model_name}/ + if e.message =~ /is not missing constant|uninitialized constant #{model_name}/ namespaces = model_name.split("::") namespaces.delete_at(-2) break if namespaces.last == model_name @@ -163,8 +163,8 @@ module ActionController unless options[:only] || options[:except] model ||= _default_wrap_model - if !(model.respond_to?(:abstract_class?) && model.abstract_class?) && model.respond_to?(:column_names) - options[:only] = model.column_names + if model.respond_to?(:attribute_names) && model.attribute_names.present? + options[:only] = model.attribute_names end end -- cgit v1.2.3