How can i bring 2 variables into the view. I am newbie in Ruby on rails.
What will the sytax to bring 2 or more values into a view.
<%= form_for(@user) do |f| %>
EDIT :
<%= form_for(@user) do |f| %>
prohibited this user from being saved: </h2>
<u1>
<% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</u1>
</div>
<% end %>
<%= debug @user %>
<div class = "field">
<%= f.label :email %><br/>
<%= f.text_field :email %>
</div>
Let’s say that in the above code I want to print values from 2 objects and also submit them. How can I do that ?
from your above comment “I am talking about loading 2 model into one form” I think you need to use two model in one form so rails cast produce good episode on using nested model for form .
You can use accepts_nested_attributes_for for eg. for survey is one model and question is another model you can use question as nested_attributes in survey and same you can use answers model in survey model in same form.
For more you can read following link.
http://railscasts.com/episodes/196-nested-model-form-part-1?view=asciicast
I hope this will help you.
Thanks.