Permalink
Browse files

ask the form builder for form tag attributes

  • Loading branch information...
1 parent b934034 commit 497c4bbd474fce78bed9289a1788c09fbf9b514a @tenderlove tenderlove committed Jan 2, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 actionpack/lib/action_view/helpers/form_helper.rb
@@ -436,7 +436,7 @@ def form_for(record, options = {}, &proc)
builder = options[:parent_builder] = instantiate_builder(object_name, object, options)
fields_for = fields_for(object_name, object, options, &proc)
default_options = builder.multipart? ? { multipart: true } : {}
- default_options.merge!(options[:html])
+ default_options.merge! builder.form_tag_attributes
form_tag(options[:url] || {}, default_options) { fields_for }
end
@@ -1174,7 +1174,7 @@ class FormBuilder
attr_accessor :object_name, :object, :options
- attr_reader :multipart, :parent_builder, :index
+ attr_reader :multipart, :parent_builder, :index, :form_tag_attributes
alias :multipart? :multipart
def multipart=(multipart)
@@ -1201,6 +1201,7 @@ def initialize(object_name, object, template, options, block=nil)
@nested_child_index = {}
@object_name, @object, @template, @options = object_name, object, template, options
+ @form_tag_attributes = options.fetch(:html, {})
@parent_builder = options[:parent_builder]
@default_options = @options ? @options.slice(:index, :namespace) : {}
if @object_name.to_s.match(/\[\]$/)

0 comments on commit 497c4bb

Please sign in to comment.