Re: [Rails] undefined method `user_id' for nil:NilClass | Devise and Rails 4

2016-05-19 Thread Deepak Sharma
On Fri, May 20, 2016 at 2:40 AM, Colin Law wrote: > > Note that here you have put @student.user_id > Also note that her you have said student.user_id (no '@') > In the code you posted initially it is @student, which is nil as you > have not assigned a value to it. Yes, I tried to different app

Re: [Rails] undefined method `user_id' for nil:NilClass | Devise and Rails 4

2016-05-19 Thread Colin Law
On 19 May 2016 at 21:58, Deepak Sharma wrote: > > On Fri, May 20, 2016 at 1:50 AM, Colin Law wrote: >> >> >> 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 someth

Re: [Rails] undefined method `user_id' for nil:NilClass | Devise and Rails 4

2016-05-19 Thread Deepak Sharma
On Fri, May 20, 2016 at 1:50 AM, Colin Law wrote: > > > 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

Re: [Rails] undefined method `user_id' for nil:NilClass | Devise and Rails 4

2016-05-19 Thread Colin Law
On 19 May 2016 at 18:52, Deepak Sharma 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

[Rails] undefined method `user_id' for nil:NilClass | Devise and Rails 4

2016-05-19 Thread Deepak Sharma
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. Here my files. *Migration* rails g migration AddUserIdToStudents user:references *user.rb* class User < ActiveRecord::Base has_many :studen