No release in over 3 years
'cont_any_word' predicate for Ransack.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

RansackPredicateContAnyWord

This gem adds the "cont_any_word" predicate to Ransack for filtering more natural and human.

Usage

User.ransack(email_cont_any_word: "@example.com test").result.to_sql #=> SELECT "users".* FROM "users" WHERE ("users"."email" LIKE '%@example.com%' AND "users"."email" LIKE '%test%')

It is also possible to search for whole sentences

User.ransack(encrypted_password_cont_any_word: '"yeah this is my password" password some').result.to_sql #=> SELECT "users".* FROM "users" WHERE ("users"."encrypted_password" LIKE '%yeah this is my password%' AND "users"."encrypted_password" LIKE '%password%' AND "users"."encrypted_password" LIKE '%some%')

Installation

Add this line to your application's Gemfile:

gem 'ransack_predicate_cont_any_word'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ransack_predicate_cont_any_word

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.