Module: TransForms::MainModel::ClassMethods

Defined in:
lib/trans_forms/main_model.rb

Instance Method Summary collapse

Instance Method Details

#set_main_model(model, options = {}) ⇒ Object

This method will extend the BaseForm functionality with the TransForms::MainModel::Active module.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/trans_forms/main_model.rb', line 9

def set_main_model(model, options = {})
  include TransForms::MainModel::Active

  # Stores the main_model record in a class_attribute
  class_attribute :main_model
  self.main_model = model

  # Defines an instance accessor for the main_model
  attr_accessor model

  # Implements proxy module that overwrites model_name method
  # to instead return an ActiveModel::Mame class for the
  # main_model class
  include TransForms::MainModel::Proxy if options[:proxy]
end