ruby on rails 3 - Better way fo filter boolean value from model -
what's difference between these 2 methods?
class model < activerecord::base def self.approved self.where("approved = 1") end def self.approved approved: true end end
so..some code again
1.9.3p374 :001 > 1 == true => false 1.9.3p374 :002 > 0 == false => false
1 not true, , 0 not false. means, first used when type of approved
column integer, , second - boolean
Comments
Post a Comment