Re: [Rails] Re: Re: Re: Re: You have a nil object when you didn't expect it!

2016-04-01 Thread Asvini Ramesh
Colin, User.active.first(:conditions => ["username LIKE ?, params[:id]) The above code is wrong. here your are trying to fetch the list of the active users and fetching the first record then checking the username with id value. the entire code seems wrong also in params[:id] you have to get I

Re: [Rails] Re: Re: Re: Re: You have a nil object when you didn't expect it!

2016-03-31 Thread Colin Law
On 31 March 2016 at 10:05, Naveed Alam wrote: >> It depends on whether that is ever supposed to be nil. If it is then >> you just need to test for that in your code before using it. >> >> Colin > > > In my controller's edit_privilege method I changed the below line > > from > @user = User.active.

[Rails] Re: Re: Re: Re: You have a nil object when you didn't expect it!

2016-03-31 Thread Naveed Alam
> It depends on whether that is ever supposed to be nil. If it is then > you just need to test for that in your code before using it. > > Colin In my controller's edit_privilege method I changed the below line from @user = User.active.first(:conditions => ["username LIKE BINARY(?)",params[:id]