Configuration values should be on AV::Base.

This commit is contained in:
José Valim 2010-02-02 11:32:28 +01:00
parent ec4b18ec78
commit 95eadb39bd
2 changed files with 7 additions and 20 deletions

View File

@ -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
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
class Base
cattr_accessor :default_form_builder
@@default_form_builder = ::ActionView::Helpers::FormBuilder
end
end
end

View File

@ -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