Ruby on Rails
Tuesday, July 18, 2017
yeah in this i want to know how do to insert a new users using user view or devise and respected role.
Le mardi 18 juillet 2017 22:47:12 UTC-4, David Gleba a écrit :
-- in my userscontroller if i put at the top: before_filter :authentificate_user i hav and error saying
use before_action
Le mardi 18 juillet 2017 22:47:12 UTC-4, David Gleba a écrit :
The article has an app in github.Can you download it and run it successfully?
On Tuesday, July 18, 2017 at 10:28:33 PM UTC-4, David Gleba wrote:I see that in one spot you have Admin - capitalized. and in another it is not capitalized - admin.I wonder if capitalization matters in your code.Note that we can't see your code. That makes it harder to help you when we can't see the code.
On Tuesday, July 18, 2017 at 7:07:11 PM UTC-4, babacar thiam wrote:the error says no MethodError (undefined method `name' for nil:NilClass):
app/models/user.rb:15:in `admin?'
app/models/ability.rb:7:in `initialize'
Le mardi 18 juillet 2017 17:15:51 UTC-4, Colin Law a écrit :On 18 July 2017 at 22:02, babacar thiam <thia...@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/03b6a44f-a9b5-4c86-82b3-bfaca6fcd95c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment