Created
August 15, 2017 06:56
-
-
Save iloveivyxuan/95e6a5c1404227fbe4ad880461bb52c1 to your computer and use it in GitHub Desktop.
An example of how to add a contain predicate to Arel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/config/initializers/ransack.rb | |
Ransack.configure do |config| | |
config.add_predicate 'contains', | |
arel_predicate: 'contains', | |
formatter: proc { |v| "{#{v}}" }, | |
validator: proc { |v| v.present? }, | |
type: :string | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment