rails/rails — Issue #3341: Autoloading custom form builder
Author: intechltd
Created: 2011-10-16 03:00:39+00:00
State: open

Custom form builder is not autoloaded for some reason.

I always get the same error telling that:

D:\Web\eclipse_workspace\intech_crm>rails s
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missin
g': uninitialized constant IntechCrm::Application::IntechFormBuilder (NameError)

from D:/Web/eclipse_workspace/intech_crm/config/application.rb:29:in `'
from D:/Web/eclipse_workspace/intech_crm/config/application.rb:12:in `'
from D:/Web/eclipse_workspace/intech_crm/config/application.rb:11:in `'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/comman
ds.rb:52:in `require'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/comman
ds.rb:52:in `block in '
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/comman
ds.rb:49:in `tap'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/comman
ds.rb:49:in `'
from script/rails:6:in `require'
from script/rails:6:in `

'

application.rb

config.autoload_paths += [Rails.root.join('lib'), Rails.root.join('lib', 'validators')]
config.action_view.default_form_builder = IntechFormBuilder

lib/intech_form_builder.rb

class IntechFormBuilder < ActionView::Helpers::FormBuilder
end

I am running:
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
Rails 3.1.1