mirror of
https://github.com/activerecord-hackery/ransack.git
synced 2022-11-09 13:47:45 -05:00
Use fewer conditionals & simplify the required files
This commit is contained in:
parent
e01b7ffc26
commit
63d4973885
1 changed files with 12 additions and 7 deletions
|
@ -10,7 +10,6 @@ end
|
|||
|
||||
module Ransack
|
||||
extend Configuration
|
||||
|
||||
class UntraversableAssociationError < StandardError; end;
|
||||
end
|
||||
|
||||
|
@ -18,20 +17,26 @@ 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/translate'
|
||||
require 'ransack/adapters/active_record/ransack/translate' if defined?(::ActiveRecord::Base)
|
||||
require 'ransack/adapters/mongoid/ransack/translate' if defined?(::Mongoid)
|
||||
require 'ransack/search'
|
||||
require 'ransack/ransacker'
|
||||
require 'ransack/adapters/active_record' if defined?(::ActiveRecord::Base)
|
||||
require 'ransack/adapters/mongoid' if defined?(::Mongoid)
|
||||
require 'ransack/helpers'
|
||||
require 'action_controller'
|
||||
|
||||
require 'ransack/translate'
|
||||
|
||||
if defined?(::ActiveRecord::Base)
|
||||
require 'ransack/adapters/active_record/ransack/translate'
|
||||
require 'ransack/adapters/active_record'
|
||||
end
|
||||
|
||||
if defined?(::Mongoid)
|
||||
require 'ransack/adapters/mongoid/ransack/translate'
|
||||
require 'ransack/adapters/mongoid'
|
||||
end
|
||||
|
||||
ActionController::Base.helper Ransack::Helpers::FormHelper
|
||||
|
|
Loading…
Reference in a new issue