diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-01-12 23:01:55 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-01-12 23:01:55 -0300 |
commit | ad70d9daf214dd9dcdcae353f0006218f20ca549 (patch) | |
tree | 2b68460d1f0a1f3395bbf53f3a4aec2d3a8ae816 /actionpack | |
parent | 31472ba6328e1be5f7390840d00e67862510c2e2 (diff) | |
download | rails-ad70d9daf214dd9dcdcae353f0006218f20ca549.tar.gz rails-ad70d9daf214dd9dcdcae353f0006218f20ca549.tar.bz2 rails-ad70d9daf214dd9dcdcae353f0006218f20ca549.zip |
Do not check if record is an Array twice
Diffstat (limited to 'actionpack')
-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! |