Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/translator.rb
Class Method Summary collapse
-
.translate(key, options = {}) ⇒ Object
(also: t)
:nodoc:.
Instance Method Summary collapse
-
#t ⇒ Object
Add a
translate
(ort
) method to ActiveRecord that is context-aware of what model is being invoked. -
#translate(key, options = {}) ⇒ Object
Add a
translate
(ort
) method to ActiveRecord that is context-aware of what model is being invoked.
Class Method Details
.translate(key, options = {}) ⇒ Object Also known as: t
:nodoc:
321 322 323 |
# File 'lib/translator.rb', line 321 def translate(key, ={}) #:nodoc: Translator.translate_with_scope([self.name.underscore], key, ) end |
Instance Method Details
#t ⇒ 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)
316 317 318 |
# File 'lib/translator.rb', line 316 def translate(key, ={}) Translator.translate_with_scope([self.class.name.underscore], key, ) 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, ={}) Translator.translate_with_scope([self.class.name.underscore], key, ) end |