Ruby on Rails Tuesday, July 18, 2017

On 18 July 2017 at 22:02, babacar thiam <thiamdu33@gmail.com> wrote:
>
> hi i have a mistake since this morning .
>
> undefined method `name' for nil:NilClass
>
> Extracted source (around line #15):

>
> end
> def admin?
> self.role.name == "Admin"
> end
> def seller?
> self.role.name == "Seller"
>

As the error says, self.role is nil

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+unsubscribe@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%3D0gLvmToy1bLObRc8JQ5hiUz%3D00xaGLesq3Y1-oDa4ub7Ung%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment