1
0
Fork 0
mirror of https://github.com/activerecord-hackery/ransack.git synced 2022-11-09 13:47:45 -05:00
activerecord-hackery--ransack/lib/ransack.rb
yuuji.yaginuma 368945bede use ActiveSupport.on_load to hook into Active Record
For avoiding autoloading these constants too soon.
This affect the initialization of Active Record.
Ref: https://github.com/rails/rails/issues/23589#issuecomment-229247727
2016-09-03 09:54:25 +09:00

29 lines
734 B
Ruby

require 'active_support/core_ext'
require 'ransack/configuration'
require 'ransack/adapters'
Ransack::Adapters.object_mapper.require_constants
module Ransack
extend Configuration
class UntraversableAssociationError < StandardError; end;
end
Ransack.configure do |config|
Ransack::Constants::AREL_PREDICATES.each do |name|
config.add_predicate name, :arel_predicate => name
end
Ransack::Constants::DERIVED_PREDICATES.each do |args|
config.add_predicate *args
end
end
require 'ransack/search'
require 'ransack/ransacker'
require 'ransack/helpers'
require 'action_controller'
require 'ransack/translate'
Ransack::Adapters.object_mapper.require_adapter
ActionController::Base.helper Ransack::Helpers::FormHelper