Sha256: 3b3ce1370c2dc8c00cdb5180698464843b175e234d56f82e72bffb7fc4800fac
Contents?: true
Size: 1.04 KB
Versions: 6
Compression:
Stored size: 1.04 KB
Contents
module Superstore module Associations extend ActiveSupport::Concern module ClassMethods # === Options # [:class_name] # Use if the class cannot be inferred from the association # [:polymorphic] # Specify if the association is polymorphic # Example: # class Driver < Superstore::Base # end # class Truck < Superstore::Base # end def belongs_to(name, options = {}) if options.delete(:superstore) Superstore::Associations::Builder::BelongsTo.build(self, name, options) else super end end def has_many(name, options = {}) if options.delete(:superstore) Superstore::Associations::Builder::HasMany.build(self, name, options) else super end end def has_one(name, options = {}) if options.delete(:superstore) Superstore::Associations::Builder::HasOne.build(self, name, options) else super end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems