Module: Trax::Model::STI::Attributes

Extended by:
ActiveSupport::Concern
Defined in:
lib/trax/model/sti/attributes.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#attribute_setObject



31
32
33
34
35
# File 'lib/trax/model/sti/attributes.rb', line 31

def attribute_set
  build_attribute_set if super.nil?

  super
end

#attributesObject



27
28
29
# File 'lib/trax/model/sti/attributes.rb', line 27

def attributes
  super.merge!(sti_attributes)
end

#sti_attributesObject



37
38
39
40
41
42
43
44
# File 'lib/trax/model/sti/attributes.rb', line 37

def sti_attributes
  sti_attribute_hash = self.class._sti_attributes.inject({}) do |result, attribute|
    result["#{attribute}"] = __send__(attribute)
    result
  end

  sti_attribute_hash
end

#super!(*args) ⇒ Object



46
47
48
49
# File 'lib/trax/model/sti/attributes.rb', line 46

def super!(*args)
  method_caller = caller_locations(1,1)[0].label
  attribute_set.send(method_caller, *args)
end