Sha256: 4eeaa1ae749c587ce9bbb11b9bfcd581712e6572848dbaf295e94d86dbea5e4b

Contents?: true

Size: 805 Bytes

Versions: 4

Compression:

Stored size: 805 Bytes

Contents

# 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

4 entries across 4 versions & 2 rubygems

Version Path
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/activeadmin-2.9.0/lib/ransack_ext.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/activeadmin-2.9.0/lib/ransack_ext.rb
activeadmin-2.9.0 lib/ransack_ext.rb
activeadmin-2.8.1 lib/ransack_ext.rb