Sha256: eed0cb930d1cffd51d50694173310e7b2ec20ddf55dbdf25b1cca32b97e857ca

Contents?: true

Size: 835 Bytes

Versions: 9

Compression:

Stored size: 835 Bytes

Contents

# frozen_string_literal: true
# This sets up aliases for old Metasearch query methods so they behave
# identically to the versions given in Ransack.
#
Ransack.configure do |config|
  { "contains" => "cont", "starts_with" => "start", "ends_with" => "end" }.each do |old, current|
    config.add_predicate old, Ransack::Constants::DERIVED_PREDICATES.detect { |q, _| q == current }[1]
  end

  { "equals" => "eq", "greater_than" => "gt", "less_than" => "lt" }.each do |old, current|
    config.add_predicate old, arel_predicate: current
  end

  config.add_predicate "gteq_datetime",
                       arel_predicate: "gteq",
                       formatter: ->(v) { v.beginning_of_day }

  config.add_predicate "lteq_datetime",
                       arel_predicate: "lt",
                       formatter: ->(v) { v + 1.day }
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
activeadmin-2.14.0 lib/ransack_ext.rb
activeadmin-2.13.1 lib/ransack_ext.rb
activeadmin-2.13.0 lib/ransack_ext.rb
activeadmin-2.12.0 lib/ransack_ext.rb
activeadmin-2.11.2 lib/ransack_ext.rb
activeadmin-2.11.1 lib/ransack_ext.rb
activeadmin-2.11.0 lib/ransack_ext.rb
activeadmin-2.10.1 lib/ransack_ext.rb
activeadmin-2.10.0 lib/ransack_ext.rb