Class: Ransack::Adapters::Mongoid::Table

Inherits:
Object
  • Object
show all
Defined in:
lib/ransack/adapters/mongoid/table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, engine = nil) ⇒ Table

Returns a new instance of Table.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ransack/adapters/mongoid/table.rb', line 9

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

Instance Attribute Details

#nameObject Also known as: table_name

Returns the value of attribute name.



5
6
7
# File 'lib/ransack/adapters/mongoid/table.rb', line 5

def name
  @name
end

Instance Method Details

#[](name) ⇒ Object



28
29
30
# File 'lib/ransack/adapters/mongoid/table.rb', line 28

def [](name)
  Ransack::Adapters::Mongoid::Attribute.new self, name
end