On 31 March 2016 at 10:05, Naveed Alam <li...@ruby-forum.com> 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.first(:conditions => ["username LIKE
> BINARY(?)",params[:id]])
> to
> @user = User.active.find_by_username(params[:id])
>
> and it solved the problem. but dont know why not the above line working?

I would not have expected either to work, as I would have expected
params[:id] to contain the id of the user not the name.  What is in
params[:id]?

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+unsubscr...@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%3D0gLuKSoGCtZeEWFR84n11dUB%3D%3DzPKygu1ktdj0ioyHdKiNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to