aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2012-04-28 23:02:39 -0700
committerPiotr Sarnacki <drogus@gmail.com>2012-04-28 23:02:39 -0700
commitbeba8267c96a3dbc1f505ecc099dbf14db8dde4c (patch)
tree22d28096089a333e16b14111f6cd484f5ab4dcfd /actionpack/lib/action_view
parent7dc83f78232a6dfcdd70292e831403933f57347b (diff)
downloadrails-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.rb8
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