Module: ErpBaseErpSvcs::Extensions::ActiveRecord::ActsAsCategory::InstanceMethods

Defined in:
lib/erp_base_erp_svcs/extensions/active_record/acts_as_category.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



27
28
29
# File 'lib/erp_base_erp_svcs/extensions/active_record/acts_as_category.rb', line 27

def method_missing(name, *args)
      self.category.respond_to?(name) ? self.category.send(name, *args) : super
end

Instance Method Details

#destroy_categoryObject



35
36
37
# File 'lib/erp_base_erp_svcs/extensions/active_record/acts_as_category.rb', line 35

def destroy_category
      self.category.destroy
end

#initialize_categoryObject



39
40
41
42
43
44
45
# File 'lib/erp_base_erp_svcs/extensions/active_record/acts_as_category.rb', line 39

def initialize_category
      if self.new_record? and self.category.nil?
        category = Category.new
        self.category = category
        category.category_record = self
      end
end

#save_categoryObject



31
32
33
# File 'lib/erp_base_erp_svcs/extensions/active_record/acts_as_category.rb', line 31

def save_category
      self.category.save
end