[Rails] Re: Trying to show 3 tables in 1 view
It worked a treat! thanks a million!
Jax
On Friday, February 15, 2013 9:52:44 AM UTC, Ruby-Forum.com User wrote:
-- On Friday, February 15, 2013 9:52:44 AM UTC, Ruby-Forum.com User wrote:
In the index view of team write the code of index view of player and
select only the team players by @team.player:
<table>
<tr>
<th>Name</th>
<th>Position</th>
<th>Number</th>
</tr>
<% @team.players.each do |team_player| %>
<tr>
<td><%= team_player.first_name %> <%= team_player.last_name
%></td>
<td><%= team_player.position %></td>
<td><%= team_player.number %></td>
</tr>
<% end %>
</table>
For the results it's he same.
--
Posted via http://www.ruby-forum.com/.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/EukZiIIssncJ.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home