class Schemaker::Models::ObjectModel

Public Class Methods

new(models, clazz) click to toggle source

@param [Schema::Models] each model needs to have access to the collection of models it may need to create relations with @param [Class] reference to the Class it aims to configure!

Calls superclass method Schemaker::Models::BaseModel::new
# File lib/schemaker/models/object_model.rb, line 14
def initialize models, clazz
  super
end

Public Instance Methods

configure() click to toggle source

Configures has_many through relationship via Join model for the object model (fx Role)

Example:

Role (object)
  has_many :accounts,   :class_name => 'RefManyAccount', :through => :accounts_roles (subject)
  has_many :user_roles, :class_name => 'UserRole' (join)
Calls superclass method Schemaker::Models::BaseModel#configure
# File lib/schemaker/models/object_model.rb, line 24
def configure
  super
  create_has_many_through :subject
end
through_options(options = {}) click to toggle source

@note important to use super to avoid recursive stack overflow!

# File lib/schemaker/models/object_model.rb, line 30
def through_options options = {}
  options.merge super(:subject)
end