diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2012-04-28 23:02:39 -0700 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2012-04-28 23:02:39 -0700 |
commit | beba8267c96a3dbc1f505ecc099dbf14db8dde4c (patch) | |
tree | 22d28096089a333e16b14111f6cd484f5ab4dcfd /actionpack/lib/action_view | |
parent | 7dc83f78232a6dfcdd70292e831403933f57347b (diff) | |
download | rails-beba8267c96a3dbc1f505ecc099dbf14db8dde4c.tar.gz rails-beba8267c96a3dbc1f505ecc099dbf14db8dde4c.tar.bz2 rails-beba8267c96a3dbc1f505ecc099dbf14db8dde4c.zip |
Lazy load `default_form_builder` if it's passed as a string
closes #3341
Diffstat (limited to 'actionpack/lib/action_view')
-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 252fe1ed03..a3409ee3c7 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -9,6 +9,7 @@ require 'active_support/core_ext/module/method_names' 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/core_ext/string/inflections' module ActionView # = Action View Form Helpers @@ -959,9 +960,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, block) end + + def default_form_builder + builder = ActionView::Base.default_form_builder + builder.respond_to?(:constantize) ? builder.constantize : builder + end end class InstanceTag |