Module: TranslatedAttributeValue::Base::InstanceMethods

Defined in:
lib/translated_attribute_value/base.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/translated_attribute_value/base.rb', line 14

def method_missing(name, *args, &block)
  attribute_name = name.to_s.gsub!(/_translated$/, '') # this will return nil or the modified string
  if (attribute_name) && self.respond_to?(attribute_name)
    self.class.translated_value_for(attribute_name)
    self.send(name)
  else
    super
  end
end