I am using devise_invitable.
I am trying to find all users with invitation_token != nil
I thought that User.where(:invitation_token != nil)
will do.. but it returns all users..
when I do
pry(main)> User.where(:invitation_token != nil)[0].invitation_token
User Load (1.0ms) SELECT "users".* FROM "users" WHERE ('t')
=> nil
so I don’t understand what’s going on here.. How do I find models using where when the test is false?
You should do:
Your solution does not work, because
:invitation_token != nilwill evaluate totrue, so what you actually did was: