Class: ActiveScaffold::DataStructures::Association::ActiveMongoid
- Defined in:
- lib/active_scaffold/data_structures/association/active_mongoid.rb
Instance Attribute Summary
Attributes inherited from Abstract
Class Method Summary collapse
Instance Method Summary collapse
- #allow_join? ⇒ Boolean
- #belongs_to? ⇒ Boolean
-
#has_many? ⇒ Boolean
rubocop:disable Naming/PredicateName.
-
#has_one? ⇒ Boolean
rubocop:disable Naming/PredicateName.
- #inverse_klass ⇒ Object
- #table_name ⇒ Object
Methods inherited from Mongoid
#association_primary_key, #counter_cache, #foreign_type, #polymorphic?, #primary_key, #quoted_primary_key, #quoted_table_name
Methods inherited from Abstract
#as, #collection?, #counter_cache_hack?, #habtm?, #initialize, #inverse_for?, #klass, #polymorphic?, #quoted_primary_key, #quoted_table_name, #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
3 4 5 6 |
# 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
12 13 14 |
# File 'lib/active_scaffold/data_structures/association/active_mongoid.rb', line 12 def allow_join? false end |
#belongs_to? ⇒ Boolean
16 17 18 |
# File 'lib/active_scaffold/data_structures/association/active_mongoid.rb', line 16 def belongs_to? %i[belongs_to_record belongs_to_document].include?(@association.macro) end |
#has_many? ⇒ Boolean
rubocop:disable Naming/PredicateName
24 25 26 |
# File 'lib/active_scaffold/data_structures/association/active_mongoid.rb', line 24 def has_many? # rubocop:disable Naming/PredicateName %i[has_many_records has_many_documents].include?(@association.macro) end |
#has_one? ⇒ Boolean
rubocop:disable Naming/PredicateName
20 21 22 |
# File 'lib/active_scaffold/data_structures/association/active_mongoid.rb', line 20 def has_one? # rubocop:disable Naming/PredicateName %i[has_one_record has_one_document].include?(@association.macro) end |
#inverse_klass ⇒ Object
8 9 10 |
# File 'lib/active_scaffold/data_structures/association/active_mongoid.rb', line 8 def inverse_klass as ? @association[:inverse_class_name].constantize : super end |
#table_name ⇒ Object
28 29 30 |
# File 'lib/active_scaffold/data_structures/association/active_mongoid.rb', line 28 def table_name @association.klass < ActiveRecord::Base ? @association.klass.table_name : super end |