In my controller.rb I have the following code:
@teams = Team.all
Here is some sample output:
<Team id: 1, name: "Eastside", nick: "Bunnies", api_team_id: 3235, created_at: "2013-01-18
21:19:24", updated_at: "2013-01-18 21:19:24">
<Team id: 2, name: "Westside", nick: "Turtles", api_team_id: 3235, created_at: "2013-01-18
21:19:24", updated_at: "2013-01-18 21:19:24">
<Team id: 3, name: "Northside", nick: "Birds", api_team_id: 3235, created_at: "2013-01-18
21:19:24", updated_at: "2013-01-18 21:19:24">
How can I create a dropdown list that will display Team.name and Team.nick for each item?
Also, how can I link_to the team’s respective team.id?
I think you need to read some Rails tutorials first.
For the dropdown menu:
About the
link_tothe team’s show page, I assume you declared your resources in your routes.rb. If so, you should have the 4 CRUD Action (Create Retrieve Update Delete).Then if everything is set up correctly, you could do: