Wednesday, June 23, 2010

[Rails] Custom default form builder in Rails 3

Hello everyone,

I am trying to set a default custom form builder.
I have defined my form builder class in "lib/mymodule/mybuilder.rb"
as:

module Mymodule
class Mybuilder < ActionView::Helpers::FormBuilder
......
end
end

Then I am trying to use this custom class in application.rb as
config.action_view.default_form_builder = Mymodule::Mybuilder. But I
get "Uninitialized constant error."

Does this mean that my module stored in "lib" directory is not loaded
automatically?

Thanks in advance,

p.s. I am a newbie to Ruby and Rails as well. I can't really
understand the module and class loading process in rails. I will
appreciate if someone explains me a little bit which folders are
loaded in initialization process, which I should "require 'someclass'"
explicitly.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate