# File lib/active_scaffold/data_structures/association/active_mongoid.rb, line 8 def primary_key @association[:primary_key] end
class ActiveScaffold::DataStructures::Association::ActiveMongoid
Public Class Methods
reflect_on_all_associations(klass)
click to toggle source
# 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
Public Instance Methods
allow_join?()
click to toggle source
# File lib/active_scaffold/data_structures/association/active_mongoid.rb, line 20 def allow_join? false end
belongs_to?()
click to toggle source
# File lib/active_scaffold/data_structures/association/active_mongoid.rb, line 24 def belongs_to? %i[belongs_to_record belongs_to_document].include?(@association.macro) end
counter_cache()
click to toggle source
# File lib/active_scaffold/data_structures/association/active_mongoid.rb, line 12 def counter_cache @association[:counter_cache] end
has_many?()
click to toggle source
# File lib/active_scaffold/data_structures/association/active_mongoid.rb, line 32 def has_many? # rubocop:disable Naming/PredicateName %i[has_many_records has_many_documents].include?(@association.macro) end
has_one?()
click to toggle source
# File lib/active_scaffold/data_structures/association/active_mongoid.rb, line 28 def has_one? # rubocop:disable Naming/PredicateName %i[has_one_record has_one_document].include?(@association.macro) end
inverse_klass()
click to toggle source
Calls superclass method
# File lib/active_scaffold/data_structures/association/active_mongoid.rb, line 16 def inverse_klass as ? @association[:inverse_class_name].constantize : super end
primary_key()
click to toggle source
table_name()
click to toggle source
Calls superclass method
# File lib/active_scaffold/data_structures/association/active_mongoid.rb, line 36 def table_name @association.klass < ActiveRecord::Base ? @association.klass.table_name : super end
Protected Instance Methods
reflect_on_association(name)
click to toggle source
# File lib/active_scaffold/data_structures/association/active_mongoid.rb, line 42 def reflect_on_association(name) @association.klass.reflect_on_am_association(name) end