Class: ActiveScaffold::DataStructures::Association::Mongoid

Inherits:
Abstract
  • Object
show all
Defined in:
lib/active_scaffold/data_structures/association/mongoid.rb

Direct Known Subclasses

ActiveMongoid

Instance Attribute Summary

Attributes inherited from Abstract

#reverse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Abstract

#allow_join?, #as, #belongs_to?, #collection?, #counter_cache_hack?, #habtm?, #has_many?, #has_one?, #initialize, #inverse_for?, #klass, #readonly?, #respond_to_target?, #reverse_association, #scope, #singular?, #source_reflection, #through?, #through_collection?, #through_reflection, #through_singular?

Constructor Details

This class inherits a constructor from ActiveScaffold::DataStructures::Association::Abstract

Class Method Details

.reflect_on_all_associations(klass) ⇒ Object



38
39
40
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 38

def self.reflect_on_all_associations(klass)
  klass.relations.values
end

Instance Method Details

#association_primary_keyObject



14
15
16
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 14

def association_primary_key
  @association.primary_key
end

#counter_cacheObject



22
23
24
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 22

def counter_cache
  @association[:counter_cache]
end

#foreign_typeObject



18
19
20
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 18

def foreign_type
  @association.type
end

#polymorphic?Boolean

polymorphic belongs_to

Returns:

  • (Boolean)


6
7
8
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 6

def polymorphic?
  belongs_to? && @association.polymorphic?
end

#primary_keyObject



10
11
12
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 10

def primary_key
  @association[:primary_key]
end

#quoted_primary_keyObject



34
35
36
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 34

def quoted_primary_key
  '_id'
end

#quoted_table_nameObject



30
31
32
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 30

def quoted_table_name
  table_name
end

#table_nameObject



26
27
28
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 26

def table_name
  @association.klass.collection.name
end