Browse files

Configuration values should be on AV::Base.

  • Loading branch information...
1 parent ec4b18e commit 95eadb39bd2abe986f0981a8e03c317ec9c1bca0 @josevalim josevalim committed Feb 2, 2010
Showing with 7 additions and 20 deletions.
  1. +4 −17 actionpack/lib/action_view/helpers/form_helper.rb
  2. +3 −3 actionpack/test/template/form_helper_test.rb
View
21 actionpack/lib/action_view/helpers/form_helper.rb
@@ -528,7 +528,7 @@ def fields_for(record_or_name_or_array, *args, &block)
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 @@ def nested_child_index(name)
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
View
6 actionpack/test/template/form_helper_test.rb
@@ -1195,8 +1195,8 @@ def test_form_for_with_labelled_builder
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 @@ def test_default_form_builder
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

0 comments on commit 95eadb3

Please sign in to comment.