Formtastic nested model form fields (Rails 3)
Posted
by elsurudo
on Stack Overflow
See other posts from Stack Overflow
or by elsurudo
Published on 2010-06-13T17:03:14Z
Indexed on
2010/06/13
17:12 UTC
Read the original article
Hit count: 621
So here's the scenario:
User:
has_one :company
accepts_nested_attributes_for :company
Controller:
@user = User.new
@user.build_company
View:
<% semantic_form_for @user, :url => register_path do |form| %>
<h2>User Information</h2>
<%= form.inputs %>
<h2>Company Information</h2>
<% form.semantic_fields_for :company do |company| %>
<%= company.inputs %>
<% end %>
<%= form.buttons %>
<% end %>
After scouring the web, this SEEMS like it should work. However, all I get are the user inputs. The "semantic_fields_for :company" block outputs nothing at all...
Am I missing something here, or is this perhaps a Rails 3 bug to do with Formtastic?
© Stack Overflow or respective owner