Class: ActionController::Base

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

Instance Method Summary collapse

Instance Method Details

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

Add a translate (or t) method to ActionController that is context-aware of what controller and action is being invoked. Initial scoping will be [:controller_name :action_name] when looking up keys. Example would be [‘posts’ ‘show’] for the PostsController and show action.



299
300
301
# File 'lib/translator.rb', line 299

def translate_with_context(key, options={})
  Translator.translate_with_scope([self.controller_name, self.action_name], key, options)
end