Class: ActiveScaffold::DataStructures::Association::ActiveMongoid
- Inherits:
-
Mongoid
show all
- Defined in:
- lib/active_scaffold/data_structures/association/active_mongoid.rb
Instance Attribute Summary
Attributes inherited from Abstract
#reverse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Mongoid
#association_primary_key, #foreign_type, #habtm?, #macro_mapping?, #polymorphic?, #quoted_primary_key, #quoted_table_name
Methods inherited from Abstract
#as, #cache_count?, #collection?, #counter_cache_hack?, #habtm?, #initialize, #inverse_for?, #klass, #nested?, #polymorphic?, #quoted_primary_key, #quoted_table_name, #readonly?, #respond_to_target?, #reverse_association, #scope, #singular?, #source_reflection, #through?, #through_collection?, #through_reflection, #through_singular?
Class Method Details
.reflect_on_all_associations(klass) ⇒ Object
3
4
5
6
7
|
# File 'lib/active_scaffold/data_structures/association/active_mongoid.rb', line 3
def self.reflect_on_all_associations(klass)
return [] unless klass.respond_to? :am_relations
klass.am_relations.values
end
|
Instance Method Details
#allow_join? ⇒ Boolean
21
22
23
|
# File 'lib/active_scaffold/data_structures/association/active_mongoid.rb', line 21
def allow_join?
false
end
|
#belongs_to? ⇒ Boolean
25
26
27
|
# File 'lib/active_scaffold/data_structures/association/active_mongoid.rb', line 25
def belongs_to?
%i[belongs_to_record belongs_to_document].include?(@association.macro)
end
|
#counter_cache ⇒ Object
13
14
15
|
# File 'lib/active_scaffold/data_structures/association/active_mongoid.rb', line 13
def counter_cache
@association[:counter_cache]
end
|
#has_many? ⇒ Boolean
rubocop:disable Naming/PredicateName
33
34
35
|
# File 'lib/active_scaffold/data_structures/association/active_mongoid.rb', line 33
def has_many? %i[has_many_records has_many_documents].include?(@association.macro)
end
|
#has_one? ⇒ Boolean
rubocop:disable Naming/PredicateName
29
30
31
|
# File 'lib/active_scaffold/data_structures/association/active_mongoid.rb', line 29
def has_one? %i[has_one_record has_one_document].include?(@association.macro)
end
|
#inverse_klass ⇒ Object
17
18
19
|
# File 'lib/active_scaffold/data_structures/association/active_mongoid.rb', line 17
def inverse_klass
as ? @association[:inverse_class_name].constantize : super
end
|
#primary_key ⇒ Object
9
10
11
|
# File 'lib/active_scaffold/data_structures/association/active_mongoid.rb', line 9
def primary_key
@association[:primary_key]
end
|
#table_name ⇒ Object
37
38
39
|
# File 'lib/active_scaffold/data_structures/association/active_mongoid.rb', line 37
def table_name
@association.klass < ActiveRecord::Base ? @association.klass.table_name : super
end
|