I have an instance in a method that is like this
@existinguser = User.where("trial_account_made_by = !nil? ")
I want to return all users where the trial_account_made_by ( a column in users table) is not nil. How do I pass that to where?
尝试使用trial_account_made_by is not null
因为:
@existinguser = User.where("trial_account_made_by is not null")
For Rails 4.x
, use
@existinguser = User.where.not(trial_account_made_by: nil)
For Rails 3.x
, use
@existinguser = User.where('trial_account_made_by is not null')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.