activerecord - How to compare null in rails active record query -


how can match null in rails active record.

user.where(['id = ? , active = ? , activation_code = ?', params[:id], 0, null]).first 

or

 user.where(['id = ? , active = ? , activation_code = ?', params[:id], 0, nil]).first 

both not working.

try this:

user.where(['id = ? , active = ? , activation_code null', params[:id], 0]).first 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -