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/adapters/mongoid/table.rb
2014-11-03 16:54:17 -08:00

35 lines
888 B
Ruby

module Ransack
module Adapters
module Mongoid
class Table
attr_accessor :name
alias :table_name :name
def initialize(object, engine = nil)
@object = object
@name = object.collection.name
@engine = engine
@columns = nil
@aliases = []
@table_alias = nil
@primary_key = nil
if Hash === engine
# @engine = engine[:engine] || Table.engine
# Sometime AR sends an :as parameter to table, to let the table know
# that it is an Alias. We may want to override new, and return a
# TableAlias node?
# @table_alias = engine[:as] unless engine[:as].to_s == @name
end
end
def [](name)
Ransack::Adapters::Mongoid::Attribute.new self, name
end
end
end
end
end