module Superstore::Associations::ClassOverrides

Public Instance Methods

belongs_to(name, options = {}) click to toggle source

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
Calls superclass method
# File lib/superstore/associations.rb, line 21
def belongs_to(name, options = {})
  if options.delete(:superstore)
    Superstore::Associations::Builder::BelongsTo.build(self, name, options)
  else
    super
  end
end
belongs_to_required_by_default() click to toggle source
# File lib/superstore/associations.rb, line 45
def belongs_to_required_by_default
  false
end
has_many(name, options = {}) click to toggle source
Calls superclass method
# File lib/superstore/associations.rb, line 29
def has_many(name, options = {})
  if options.delete(:superstore)
    Superstore::Associations::Builder::HasMany.build(self, name, options)
  else
    super
  end
end
has_one(name, options = {}) click to toggle source
Calls superclass method
# File lib/superstore/associations.rb, line 37
def has_one(name, options = {})
  if options.delete(:superstore)
    Superstore::Associations::Builder::HasOne.build(self, name, options)
  else
    super
  end
end