diff options
author | José Valim <jose.valim@gmail.com> | 2012-01-13 01:46:14 -0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-01-13 01:46:14 -0800 |
commit | eea28652c95a062c3b798e37f32852759a003247 (patch) | |
tree | 3e79d5c7a99055c220d4a080a0553503fd037164 /actionpack/lib | |
parent | 3f70c10300352728418b564b8e425ca95aa33ead (diff) | |
parent | ad70d9daf214dd9dcdcae353f0006218f20ca549 (diff) | |
download | rails-eea28652c95a062c3b798e37f32852759a003247.tar.gz rails-eea28652c95a062c3b798e37f32852759a003247.tar.bz2 rails-eea28652c95a062c3b798e37f32852759a003247.zip |
Merge pull request #4439 from rafaelfranca/av-refactor
Do not check if record is an Array twice
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index fdddb33c31..ca2eb1ac10 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -365,7 +365,7 @@ module ActionView else object = record.is_a?(Array) ? record.last : record object_name = options[:as] || ActiveModel::Naming.param_key(object) - apply_form_for_options!(record, options) + apply_form_for_options!(record, object, options) end options[:html][:remote] = options.delete(:remote) if options.has_key?(:remote) @@ -380,8 +380,7 @@ module ActionView output.safe_concat('</form>') end - def apply_form_for_options!(object_or_array, options) #:nodoc: - object = object_or_array.is_a?(Array) ? object_or_array.last : object_or_array + def apply_form_for_options!(record, object, options) #:nodoc: object = convert_to_model(object) as = options[:as] @@ -392,7 +391,7 @@ module ActionView :method => method ) - options[:url] ||= polymorphic_path(object_or_array, :format => options.delete(:format)) + options[:url] ||= polymorphic_path(record, :format => options.delete(:format)) end private :apply_form_for_options! |