Sha256: 39de6b3962e68f110d56d8cc6c3233abb269c760f328ca46f79d2cd3b582cf2c
Contents?: true
Size: 1.29 KB
Versions: 13
Compression:
Stored size: 1.29 KB
Contents
module ActiveScaffold::DataStructures::Association class Mongoid < Abstract delegate :inverse_klass, :as, :dependent, :inverse, to: :@association def belongs_to? # once Ruby 2.6 support is dropped, use macro_mapping? always defined?(::Mongoid::Association) ? macro_mapping?(:belongs_to) : super end def has_one? # rubocop:disable Naming/PredicateName defined?(::Mongoid::Association) ? macro_mapping?(:has_one) : super end def has_many? # rubocop:disable Naming/PredicateName defined?(::Mongoid::Association) ? macro_mapping?(:has_many) : super end def habtm? defined?(::Mongoid::Association) ? macro_mapping?(:has_and_belongs_to_many) : super end # polymorphic belongs_to def polymorphic? belongs_to? && @association.polymorphic? end def association_primary_key @association.primary_key end def foreign_type @association.type end def table_name @association.klass.collection.name end def quoted_table_name table_name end def quoted_primary_key '_id' end def self.reflect_on_all_associations(klass) klass.relations.values end def macro_mapping?(macro) @association.is_a? ::Mongoid::Association::MACRO_MAPPING[macro] end end end
Version data entries
13 entries across 13 versions & 1 rubygems