Code below displays pitchers attached to a given scoreboard -- but i want to be able to edit the pitchers using this page to click 'edit' from. Is there a way i can have the pitcher's name be a hyperlink, and i need the pitcher.id to tell the app which pitcher to edit.
When i run the below as is... my 'Edit' link looks like http://localhost:3000/pitchers/edit/666… but there's no pitcher with an id of 666 -- which is the game id -- and it returns the error 'Couldn't find Pitcher with ID=666'
the code in question is this: <%= link_to 'Edit', :controller => 'pitchers', :action => 'edit', :id => @pitcher %>
Any help is appreciated.
-Chris
<% for column in Scoreboard.content_columns %> <p> <b><%= column.human_name %>:</b> <%=h @scoreboard.send(column.name) %> </p> <% end %>
<%= link_to 'Edit', :action => 'edit', :id => @scoreboard %> | <%= link_to 'Back', :action => 'list' %> <hr/> <h3>Pitchers</h3> <% for pitcher in @scoreboard.pitchers %> <table width="70%" border="0"> <tr> <td width="230"><div align="left"><%= pitcher.flname %> (<%= pitcher.team %>) <%= link_to 'Edit', :controller => 'pitchers', :action => 'edit', :id => @pitcher %></div></td> <td><div align="left"><strong>IP</strong>: <%= pitcher.innp %></
</td>
<td><div align="center"><strong>R</strong>: <%= pitcher.runs %></
</td>
<td><div align="center"><strong>H</strong>: <%= pitcher.hits %></
</td>
<td><div align="center"><strong>E</strong>: <%= pitcher.eruns %></
</td>
<td><div align="center"><strong>W</strong>: <%= pitcher.bballs %></
</td>
<td><div align="center"><strong>K</strong>: <%= pitcher.Ks %></
</td>
<td><div align="center"><strong>HR</strong>: <%= pitcher.HRs %></
</td>
<td><div align="center"><strong>ERA</strong>: <%= pitcher.ERA %></
</td>
</tr> </table> <hr /> <% end %>
<%= form_tag :action => "pitcher", :id => @scoreboard %> <%= text_field "pitcher", "flname" %><br/> <%= submit_tag "Add Pitcher!"%> </form>