activerecord - Rails Active Record Displaying Model Row in View Unbidden -
issue: relatively new rails. figured out how display data associated models whole table row being rendered in looks array in bottom of div. suggestions welcome.
[#<shorttermgoal id: 1, user_id: nil, contact_id: 4, title: "small blah", description: "blah blah blah ", created_at: "2015-05-31 13:58:31", updated_at: "2015-05-31 13:58:31">]
view code:
<div class="group"> <h3>personal goals</h3> <div> <fieldset> <legend>short term goals</legend> <div class="row"> <div class="small-12 columns"> <ol> <%= @contact.short_term_goals.all.each |short_term_goals| %> <li><strong><%= short_term_goals.title %></strong> <%= simple_format(short_term_goals.description) %> </li> <% end %> </ol> </div> </div> </fieldset> <fieldset> <legend>long term goals</legend> <div class="row"> <div class="small-12 columns"> <%= @contact.long_term_goals.each |long_term_goals| %> <ol> <li><strong><%= long_term_goals.title %></strong> <%= simple_format(long_term_goals.description) %></li> <% end %> </ol> </div> </div> </fieldset> </div> </div>
your each loop wrapped wrong type of tag.
v <% @contact.short_term_goals.all.each |short_term_goals| %> <li><strong><%= short_term_goals.title %></strong> <%= simple_format(short_term_goals.description) %> </li> <% end %>
Comments
Post a Comment