ruby on rails 3 - ActiveRecord where method -


i have model sample attribute car

car csv different car names

x.car = "bmw,ferrari,audi" sample.where(:car => "bmw") 

returns [].

how can use operator in sql returns x

use condition in method (works prepared queries).

sample.where("car ?", "bmw%") 

more examples can found in rails guide.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -