Module: Stonean::ClassyInheritance::ClassMethods

Defined in:
lib/classy-inheritance.rb

Instance Method Summary collapse

Instance Method Details

#depends_on(model_sym, options = {}) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/classy-inheritance.rb', line 26

def depends_on(model_sym, options = {}) 
  define_relationship(model_sym,options)

  validates_presence_of model_sym
  validates_associated model_sym

  # Before save functionality to create/update the requisite object
  define_save_method(model_sym, options[:as])

  define_find_method(model_sym)


  options[:attrs].each{|attr| define_accessors(model_sym, attr)}
end