Module: Padrino::Contrib::Orm::ActiveRecord::Translate::InstanceMethods

Defined in:
lib/padrino-contrib/orm/active_record/translate.rb

Overview

ClassMethods

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments) ⇒ Object



32
33
34
35
36
# File 'lib/padrino-contrib/orm/active_record/translate.rb', line 32

def method_missing(method_name, *arguments)
  attribute = "#{method_name}_#{I18n.locale}".to_sym
  return self.send(attribute) if I18n.locale.present? && self.respond_to?(attribute)
  super
end