On 26 June 2015 at 16:40, David Williams <li...@ruby-forum.com> wrote:
> Nugi Nugraha wrote in post #1175693:
>> On Fri, Jun 26, 2015 at 7:20 AM, David Williams <li...@ruby-forum.com>
>> wrote:
>>
>>> unless: avatar.nil?) %></li>
>>>
>>
>> I think error message is obvious
>> you got that error because @user was nil
>> if you're using devise, you can try this instead
>> "current_user.avatar.url(:thumb)"
>>
>>
>> --
>> Mou Dareka no, tame janakutte
>> Jibun no Tame ni Warette Iru
>>
>> ( Aqua Timez - Alones )
>
> I'm getting this error in my logs file. The current_user is signed in
> btw.
>
> User Load (1.0ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = ?
> ORDER BY "users"."id" ASC LIMIT 1  [["id", 3]]
> Completed 500 Internal Server Error in 2302ms (ActiveRecord: 2.0ms)
>
> NameError - undefined local variable or method `avatar' for
> #<#<Class:0x58867e0>:0x5885d78>:

Is that the same error (undefined method `avatar' for nil:NilClass) or
a new one?  If a new one then show us the full error message and the
line of code it relates to.  If the same error then, as the previous
poster said, it is because @user is nil.

Also what is the code
unless: avatar.nil?
supposed to be doing?  I see no code setting up a variable avatar.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsET%2Bxr%3DUxWS%3DJWoM1aX3CTV5DUnTZZeVDJ%2B%2BZ-YwYv4w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to