diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2012-04-07 19:29:17 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2012-04-28 22:32:46 -0700 |
commit | e6ab0d56cf5d376f4b351282c606ecc74e6fad9a (patch) | |
tree | 73fc6ea95a96c41c91e321ff46fdf893275e857a /actionpack/lib/action_view/helpers | |
parent | 1a4e27ff96b3b7add1a4a43ca757ea8ee6c05c00 (diff) | |
download | rails-e6ab0d56cf5d376f4b351282c606ecc74e6fad9a.tar.gz rails-e6ab0d56cf5d376f4b351282c606ecc74e6fad9a.tar.bz2 rails-e6ab0d56cf5d376f4b351282c606ecc74e6fad9a.zip |
Lazy load `default_form_builder` if it's passed as a string
closes #3341
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 8e7224937d..67f2abe509 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -10,6 +10,7 @@ require 'active_support/core_ext/object/blank' require 'active_support/core_ext/string/output_safety' require 'active_support/core_ext/array/extract_options' require 'active_support/deprecation' +require 'active_support/core_ext/string/inflections' module ActionView # = Action View Form Helpers @@ -1039,9 +1040,14 @@ module ActionView object_name = ActiveModel::Naming.param_key(object) end - builder = options[:builder] || ActionView::Base.default_form_builder + builder = options[:builder] || default_form_builder builder.new(object_name, object, self, options) end + + def default_form_builder + builder = ActionView::Base.default_form_builder + builder.respond_to?(:constantize) ? builder.constantize : builder + end end class FormBuilder |