# I need to link an item in the 'yield'

**URL:** <https://www.ruby-forum.com/t/i-need-to-link-an-item-in-the-yield/91242>\
**Category:** Rails\
**Created:** [April 5, 2007, 11:07pm UTC](https://www.ruby-forum.com/t/i-need-to-link-an-item-in-the-yield/91242 "2007-04-05T23:07:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nubyonrails37](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/dfb087/32.png) [@nubyonrails37](https://www.ruby-forum.com/u/nubyonrails37)\
**Post date:** [April 5, 2007, 11:07pm UTC](https://www.ruby-forum.com/t/i-need-to-link-an-item-in-the-yield/91242/1 "2007-04-05T23:07:41Z")

</div>

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](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!”%\>

---

<div class="post-metadata">

**Author:** ![nubyonrails37](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/dfb087/32.png) [@nubyonrails37](https://www.ruby-forum.com/u/nubyonrails37)\
**Post date:** [April 6, 2007, 2:31am UTC](https://www.ruby-forum.com/t/i-need-to-link-an-item-in-the-yield/91242/2 "2007-04-06T02:31:01Z")

</div>

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… 🙂

-Chris
