[Rails] Re: No Method error

Ray Baxter
Mon, 10 Apr 2006 12:41:54 -0000

Alana wrote:

> I''m getting the following error and have checked and double
checked all
> my table and field names are correct. Only the field names have
> uppercase letters in them. Where am I going wrong?
>
> NoMethodError in Tblregisteredphone#list
>
> Showing app/views/tblregisteredphone/list.rhtml where line #23 raised:
>
> You have a nil object when you didn''t expect it!
> The error occured while evaluating nil.txtForename
>
> Extracted source (around line #23):
>
> 20:
> 21:
> 22:
> 23:      <%= link_to tblregisteredphone.tbluser.txtForename,
> 24: 		 :action => "list",
> 25: 		 :tbluser => "#{tblregisteredphone.tbluser.txtForename}"
%>
> 26:


Tblregisteredphone.tbluser is nil.

You didn''t initialize Tblregisteredphone[tbluser_id].

What does your controller look like?

--

Ray