2013-12-15 18:41:13 +00:00
|
|
|
require 'active_support/core_ext'
|
|
|
|
|
2011-03-31 00:31:39 +00:00
|
|
|
require 'ransack/configuration'
|
|
|
|
|
2015-05-22 15:00:03 +00:00
|
|
|
require 'ransack/adapters'
|
|
|
|
Ransack::Adapters.require_constants
|
2014-08-02 22:16:16 +00:00
|
|
|
|
2011-03-31 00:31:39 +00:00
|
|
|
module Ransack
|
|
|
|
extend Configuration
|
2011-05-30 17:00:59 +00:00
|
|
|
class UntraversableAssociationError < StandardError; end;
|
2015-09-23 14:03:04 +00:00
|
|
|
|
|
|
|
SUPPORTS_ATTRIBUTE_ALIAS =
|
|
|
|
begin
|
|
|
|
ActiveRecord::Base.respond_to?(:attribute_aliases)
|
|
|
|
rescue NameError
|
|
|
|
false
|
|
|
|
end
|
2011-03-31 00:31:39 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
Ransack.configure do |config|
|
|
|
|
Ransack::Constants::AREL_PREDICATES.each do |name|
|
2014-05-01 13:55:39 +00:00
|
|
|
config.add_predicate name, :arel_predicate => name
|
2011-03-31 00:31:39 +00:00
|
|
|
end
|
2014-08-02 22:16:16 +00:00
|
|
|
Ransack::Constants::DERIVED_PREDICATES.each do |args|
|
|
|
|
config.add_predicate *args
|
2011-03-31 00:31:39 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
require 'ransack/search'
|
2011-04-12 00:07:23 +00:00
|
|
|
require 'ransack/ransacker'
|
2011-03-31 00:31:39 +00:00
|
|
|
require 'ransack/helpers'
|
|
|
|
require 'action_controller'
|
|
|
|
|
2015-04-08 17:25:44 +00:00
|
|
|
require 'ransack/translate'
|
|
|
|
|
2015-05-22 15:00:03 +00:00
|
|
|
Ransack::Adapters.require_adapter
|
2015-04-08 17:25:44 +00:00
|
|
|
|
2013-12-10 14:00:44 +00:00
|
|
|
ActionController::Base.helper Ransack::Helpers::FormHelper
|