On 18 August 2010 12:36, Abder-Rahman Ali <[email protected]> wrote:
> I'm walking through an example in the "Head First Rails" book, but,
> instead doing the examples using Rails3.0.0.rc.
>
> But, I'm getting this error when browsing for example:
>
> http://localhost:3000/advs/1
>
> undefined method `eq' for nil:NilClass

For an error like this it is better to show the full error trace, but
first look at it yourself.  Somewhere there you will usually find a
reference to a line of your code.  Look carefully at that line and the
error and try and work out the problem yourself.  The error is saying
that you are trying to call a method on an object that is nil.  A
common cause of this is using the result of a find operation without
checking that it did in fact find a record.

If you still cannot see the problem then post the error trace and the
code around the error.

>
> Provided that my advs_controller.rb is as follows:
>
> http://pastie.org/private/cd9zntg2ite57ept288kfa

For only a few lines of code it is better in my opinion to put it
inline rather than a pastie.  Particularly consider those who may find
the thread in months and years yet to come, hoping for enlightenment,
only to find that the pastie has disappeared.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to