Ilike
Stop hardcoding sql for LIKE and ILIKE queries in your application.
This gem adds the ilike
method to your activerecord toolbelt, allowing to
write code that doesn't depend explicitly on your db adapter:
class Product < ActiveRecord::Base; end
Product.create(:name => 'Mozzarella Cheese', :price => 1.50)
Product.ilike(:name => '%cheese')
=> [#<Product id: 2, name: "Mozzarella Cheese", price: #<BigDecimal:7fdeab856c90,'0.15E1',18(18)>>]
Installation
Add this line to your application's Gemfile:
gem 'ilike'
And then execute:
$ bundle
Or install it yourself as:
$ gem install liker
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request