Module: Opensteam::Base::Extension::ActsOpensteam

Defined in:
lib/opensteam/base.rb

Overview

Extend ActiveRecord::Base with the opensteam method

Instance Method Summary collapse

Instance Method Details

#opensteam(arg, *opt) ⇒ Object

called in a model to inject product-specific methods into the class:

class Product < ActiveRecord::Base
  opensteam :product
end


98
99
100
101
102
103
104
105
106
107
108
# File 'lib/opensteam/base.rb', line 98

def opensteam(arg, *opt)
  Opensteam._logger "including #{arg.to_s.humanize} Module in #{self.to_s} Model"
  
  if arg == :product
    @opensteam_type = arg
    class_eval { include Opensteam::ProductBase }
  else
    Opensteam._logger "opensteam-method #{arg.to_s} not suppored, in #{self.to_s}"
  end

end