On 19 May 2016 at 18:52, Deepak Sharma <deeky.sharma@gmail.com> wrote:
> In my application I want only current user to edit and delete his/her stuff
> and for others stuff he just able to show it. I'm using devise with rails 4.
> ...
>
> With all that configuration I'm getting following error undefined method
> `user_id' for nil:NilClass. In my students table user_id is passing but
> still facing this error. Where am I doing wrong.
Initially what you are doing wrong is not posting the full error
message and not telling us which line of code the error refers to.
The error means that you have tried to call something.user_id but the
value of 'something' is nil. Look at the line of code the error
refers to and try to work out why the variable 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%3D0gLsaFwDRzcaUo-TZjZEaogRqq4Z11bJqjQ_Ek3kOHi15oA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment