Is it possible to split a form into multiple erb modules?

Posted by Ya. on Stack Overflow See other posts from Stack Overflow or by Ya.
Published on 2013-07-02T23:00:29Z Indexed on 2013/07/02 23:05 UTC
Read the original article Hit count: 219

Filed under:
|

I have a large form with multiple tabs and would like to be able to split it into multiple modules and include each as a partial. Something like:

main.html.erb:

  <%= form_for (@myobject) do |f| %>
       <%= render "module1" %>
       ....

module1.html.erb:

 <%= f.text_field :field1 %>
 ...

Needless to say, when I do it like this I get an error from module1 that "f" is undefined. Is there a way to split form fields into multiple modules?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about forms