Module: Ransack::Adapters

Defined in:
lib/ransack/adapters.rb,
lib/ransack/adapters/active_record/base.rb,
lib/ransack/adapters/active_record/context.rb

Defined Under Namespace

Modules: ActiveRecord Classes: ActiveRecordAdapter, MongoidAdapter

Class Method Summary collapse

Class Method Details

.instantiate_object_mapperObject


8
9
10
11
12
13
14
15
16
# File 'lib/ransack/adapters.rb', line 8

def self.instantiate_object_mapper
  if defined?(::ActiveRecord::Base)
    ActiveRecordAdapter.new
  elsif defined?(::Mongoid)
    MongoidAdapter.new
  else
    raise "Unsupported adapter"
  end
end

.object_mapperObject


4
5
6
# File 'lib/ransack/adapters.rb', line 4

def self.object_mapper
  @object_mapper ||= instantiate_object_mapper
end