# Basic usage confusion

**URL:** <https://www.ruby-forum.com/t/basic-usage-confusion/101482>\
**Category:** Rails\
**Created:** [February 6, 2006, 7:00am UTC](https://www.ruby-forum.com/t/basic-usage-confusion/101482 "2006-02-06T07:00:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [February 6, 2006, 7:00am UTC](https://www.ruby-forum.com/t/basic-usage-confusion/101482/1 "2006-02-06T07:00:57Z")

</div>

I am confused. Looking at ‘list’ from scaffold, I see a record and click  
the ‘show’ button. I put in a ‘link’ at the bottom of ‘show.rhtml’ to my  
‘view’ rfn2.rhtml - action = ‘rfn2’, :id = @placement

I click this link and get error…

log/development.log

Processing PlacementsController#rfn2 (for 127.0.0.1 at 2006-02-05  
22:44:55) [GET]  
Parameters: {“action”=\>“rfn2”, “id”=\>“4”, “controller”=\>“placements”}  
Placement Load (0.010998) SELECT \* FROM placements WHERE  
(placements.id = ‘4’) LIMIT 1  
Rendering within layouts/placements  
Rendering placements/rfn2

ActionView::TemplateError (undefined local variable or method  
`placement’ for #\<#Class:0xb78874a8:0xb7887124\>) on line #11 of  
app/views/placements/rfn2.rhtml:  
8: \<%= debug params %\>  
9: \<%= params.inspect %\>  
10:  
11: \<%= placement.referral\_date %\>

which of course is the line in rfn2.rhtml that is causing the problem.

placements\_controller.rb has…

def rfn2  
@placement = Placement.find(params[:id])  
end

just like def edit and if I click on the ‘edit’ link…no problem…I  
get the edit.rhtml with ‘id’ = “4”

Obviously, rfn2 knows I am wanting ‘id’ = ‘4’ but I get the ‘undefined  
local variable or method’ error.

And there definitely is a column ‘referral\_date’ in placements table.

Why do I get this error?

Craig

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [February 6, 2006, 7:16am UTC](https://www.ruby-forum.com/t/basic-usage-confusion/101482/2 "2006-02-06T07:16:04Z")

</div>

You might try changing the problematic line as follows:

```
<%= @placement.referral_date %>
```

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [February 6, 2006, 12:21pm UTC](https://www.ruby-forum.com/t/basic-usage-confusion/101482/3 "2006-02-06T12:21:17Z")

</div>

Could you copy the def that works with the code to redirect that works,

and then

the def that does not work, with the code to redirect that does not  
work?

maybe side to side we can understand what is goin on
