Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/translator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.translate(key, options = {}) ⇒ Object Also known as: t

:nodoc:



321
322
323
# File 'lib/translator.rb', line 321

def translate(key, options={}) #:nodoc:
  Translator.translate_with_scope([self.name.underscore], key, options)
end

Instance Method Details

#tObject

Add a translate (or t) method to ActiveRecord that is context-aware of what model is being invoked. Initial scoping of [:model_name] where model name is like ‘blog_post’ (singular - not the table name)



316
317
318
# File 'lib/translator.rb', line 316

def translate(key, options={})
  Translator.translate_with_scope([self.class.name.underscore], key, options)
end

#translate(key, options = {}) ⇒ Object

Add a translate (or t) method to ActiveRecord that is context-aware of what model is being invoked. Initial scoping of [:model_name] where model name is like ‘blog_post’ (singular - not the table name)



312
313
314
# File 'lib/translator.rb', line 312

def translate(key, options={})
  Translator.translate_with_scope([self.class.name.underscore], key, options)
end