Tutorial :content_for Inside Formbuilder


I've got a formbuilder field specifically for doing DateTime using jQuery. What I'd like to do is have the helper able to push content out to my < head > through content_for. Any ideas?

Thanks, Stefan


You can call any helper method on the @template instance variable. It holds the current template context.

class MyBuilder < ActionView::Helpers::FormBuilder      def this_method_appends_content_for(content)      @template.content_for(:head, content)    end    end  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »