The Builder class can be placed in the module file, inside or / or outside the module, for example:
The correct way to attach a builder to a form:
Here is a helper method for setting the builder option on the form:
# app/helpers/events_helper.rb module EventsHelper def form_in_for(data, *args, &proc) options = args.extract_options! form_for(data, *(args << options.merge(:builder => EventsHelper::FormBuilderIn)), &proc) end def form_out_for(data, *args, &proc) options = args.extract_options! form_for(data, *(args << options.merge(:builder => FormBuilderOut)), &proc) end end ...
Now there is an additional way to bind the builder to the form:
Finally, custom collectors can be placed in a separate folder, for example, "app / builders", but this requires that you manually add this path to the application environment. For Rails 2.3.x, install:
# config/environment.rb. config.load_paths += %W(
source share