I used nifty scaffolding for create controller ‘A’. For this controller I have in DB table(again called ‘A’).
I have view, in which is a form for entering information. These data will be stored in database.
But was request have in this form input that isn’t in table ‘A’ (column), but in table ‘B’.
<%= form_for @a do |u| %>
<%= u.error_messages %>
<p>
<%= u.label :name %><br />
<%= u.text_field :name %>
</p>
<p>
<%= u.label :age %><br />
<%= u.text_field :age %>
</p>
<p>
<%= u.label :email %><br />
<%= u.text_field :email %>
</p>
...
Input called ‘name’ will be stored in table ‘A’ (into column ‘name’), input called ‘age’ will be stored in table ‘B’ (into column ‘age’).
I want display this form in browser, I am getting error:
undefined method `age’ for…
Can you help me, please, what is needed for this situation for right displaying the form?
Use the fields_for helper Rails provides.