Sha256: 2da2ea01393aa3297e619fa2235fc015eb9e70ac363f5900542fcfaef695beb7
Contents?: true
Size: 1.55 KB
Versions: 114
Compression:
Stored size: 1.55 KB
Contents
# frozen_string_literal: true Ransack.configure do |config| # Change default search parameter key name. # Default key name is :q # config.search_key = :query # Raise errors if a query contains an unknown predicate or attribute. # Default is true (do not raise error on unknown conditions). config.ignore_unknown_conditions = !(Rails.env.development? || Rails.env.test?) # Globally display sort links without the order indicator arrow. # Default is false (sort order indicators are displayed). # This can also be configured individually in each sort link (see the README). # config.hide_sort_order_indicators = true # # Add a predicate to allow a datepicker for instance to find all items # with a certain created_at. It ensures the datetime is resolved as a date. # See # - https://github.com/activerecord-hackery/ransack/issues/101 # - https://github.com/activerecord-hackery/ransack/wiki/Custom-Predicates config.add_predicate( "date_equals", arel_predicate: "eq", formatter: proc { |val| val&.to_date }, validator: proc { |val| val.present? }, type: :string ) # This predicate is used for example in letters/lists/show when a users filters a list of letters # to display only letters with a page cont of 1 or 2, or 3 or 4, e.g. # = f.input :page_count_in_array, collection: [["1 or 2", "[1,2]"],["3 or 4", "[3,4]"]] config.add_predicate( "in_array", arel_predicate: "in", formatter: proc { |val| val.to_s.scan(/\d+/).map(&:to_i) }, validator: proc { |val| val.present? }, type: :array ) end
Version data entries
114 entries across 114 versions & 1 rubygems