I need to link an item in the 'yield'

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 %>

<%= column.human_name %>: <%=h @scoreboard.send(column.name) %>

<% end %>

<%= link_to ‘Edit’, :action => ‘edit’, :id => @scoreboard %> |
<%= link_to ‘Back’, :action => ‘list’ %>


Pitchers

<% for pitcher in @scoreboard.pitchers %>
<%= pitcher.flname %> (<%= pitcher.team %>) <%= link_to 'Edit', :controller => 'pitchers', :action => 'edit', :id => @pitcher %>
IP: <%= pitcher.innp %>
R: <%= pitcher.runs %>
H: <%= pitcher.hits %>
E: <%= pitcher.eruns %>
W: <%= pitcher.bballs %>
K: <%= pitcher.Ks %>
HR: <%= pitcher.HRs %>
ERA: <%= pitcher.ERA %>

<% end %>

<%= form_tag :action => “pitcher”, :id => @scoreboard %>
<%= text_field “pitcher”, “flname” %>

<%= submit_tag “Add Pitcher!”%>

UPDATE:

this works like i want…

<%= pitcher.flname %> (<%= pitcher.team %>) <%= link_to 'Edit', :controller => 'pitchers', :action => 'edit', :id => pitcher.id %>

I’m 37 and I can read at a 2nd grade level… :slight_smile:

-Chris