Class: ActiveScaffold::DataStructures::Association::Mongoid
- Inherits:
-
Abstract
show all
- Defined in:
- lib/active_scaffold/data_structures/association/mongoid.rb
Instance Attribute Summary
Attributes inherited from Abstract
#reverse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Abstract
#allow_join?, #belongs_to?, #counter_cache_hack?, #habtm?, #has_many?, #has_one?, #initialize, #inverse_for?, #readonly?, #respond_to_target?, #reverse_association, #scope, #singular?, #source_reflection, #through?, #through_reflection
Class Method Details
.reflect_on_all_associations(klass) ⇒ Object
41
42
43
|
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 41
def self.reflect_on_all_associations(klass)
klass.relations.values
end
|
Instance Method Details
#association_primary_key ⇒ Object
17
18
19
|
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 17
def association_primary_key
@association.primary_key
end
|
#collection? ⇒ Boolean
4
5
6
|
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 4
def collection?
%i[has_many has_and_belongs_to_many].include?(@association.macro)
end
|
#counter_cache ⇒ Object
25
26
27
|
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 25
def counter_cache
@association[:counter_cache]
end
|
#foreign_type ⇒ Object
21
22
23
|
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 21
def foreign_type
@association.type
end
|
#polymorphic? ⇒ Boolean
9
10
11
|
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 9
def polymorphic?
belongs_to? && @association.polymorphic?
end
|
#primary_key ⇒ Object
13
14
15
|
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 13
def primary_key
@association[:primary_key]
end
|
#quoted_primary_key ⇒ Object
37
38
39
|
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 37
def quoted_primary_key
'_id'
end
|
#quoted_table_name ⇒ Object
33
34
35
|
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 33
def quoted_table_name
table_name
end
|
#table_name ⇒ Object
29
30
31
|
# File 'lib/active_scaffold/data_structures/association/mongoid.rb', line 29
def table_name
@association.klass.collection.name
end
|