mirror of https://github.com/rails/rails
Configuration values should be on AV::Base.
This commit is contained in:
parent
ec4b18ec78
commit
95eadb39bd
|
@ -528,7 +528,7 @@ module ActionView
|
|||
object_name = ActionController::RecordIdentifier.singular_class_name(object)
|
||||
end
|
||||
|
||||
builder = options[:builder] || ActionView.default_form_builder
|
||||
builder = options[:builder] || ActionView::Base.default_form_builder
|
||||
yield builder.new(object_name, object, self, options, block)
|
||||
end
|
||||
|
||||
|
@ -1208,21 +1208,8 @@ module ActionView
|
|||
end
|
||||
end
|
||||
|
||||
class << ActionView
|
||||
attr_accessor :default_form_builder
|
||||
class Base
|
||||
cattr_accessor :default_form_builder
|
||||
@@default_form_builder = ::ActionView::Helpers::FormBuilder
|
||||
end
|
||||
|
||||
self.default_form_builder = ::ActionView::Helpers::FormBuilder
|
||||
|
||||
# 2.3 compatibility
|
||||
class << Base
|
||||
def default_form_builder=(builder)
|
||||
ActionView.default_form_builder = builder
|
||||
end
|
||||
|
||||
def default_form_builder
|
||||
ActionView.default_form_builder
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1195,8 +1195,8 @@ class FormHelperTest < ActionView::TestCase
|
|||
end
|
||||
|
||||
def test_default_form_builder
|
||||
old_default_form_builder, ActionView.default_form_builder =
|
||||
ActionView.default_form_builder, LabelledFormBuilder
|
||||
old_default_form_builder, ActionView::Base.default_form_builder =
|
||||
ActionView::Base.default_form_builder, LabelledFormBuilder
|
||||
|
||||
form_for(:post, @post) do |f|
|
||||
concat f.text_field(:title)
|
||||
|
@ -1213,7 +1213,7 @@ class FormHelperTest < ActionView::TestCase
|
|||
|
||||
assert_dom_equal expected, output_buffer
|
||||
ensure
|
||||
ActionView.default_form_builder = old_default_form_builder
|
||||
ActionView::Base.default_form_builder = old_default_form_builder
|
||||
end
|
||||
|
||||
def test_default_form_builder_with_active_record_helpers
|
||||
|
|
Loading…
Reference in New Issue