grzegorz-DQHbisZZJXZfHc8IkofHig@public.gmane.org
2014-Sep-21 12:25 UTC
Setting the default form builder
Hi, I implemented a custom form builder called BootstrapFormBuilder. I wanted to use it as the default form builder. I did manage to do that but not without problems. I'd like you to help me understand why my initial approach didn't work. I put my class in app/helpers/bootstrap_form_builder.rb. Following the Rails Guide I added: Rails.application.config.action_view.default_form_builder = BootstrapFormBuilder to an initializer. Unfortunately form_for was still using the default form builder. I had to change the line above to: ActionView::Base.default_form_builder = BootstrapFormBuilder That approach worked. I have two questions: 1. why didn't my initial approach work? 2. if it doesn't change the default form builder then what does it do? Regards -- Greg -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2625ebe8-edaa-4910-aa09-0a57cb5aeaff%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.