Skip to content

Instantly share code, notes, and snippets.

@iloveivyxuan
Created August 15, 2017 06:56
Show Gist options
  • Save iloveivyxuan/95e6a5c1404227fbe4ad880461bb52c1 to your computer and use it in GitHub Desktop.
Save iloveivyxuan/95e6a5c1404227fbe4ad880461bb52c1 to your computer and use it in GitHub Desktop.
An example of how to add a contain predicate to Arel
# 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