Skip to content

Instantly share code, notes, and snippets.

@clemens
Created July 8, 2014 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clemens/669b5552431541789716 to your computer and use it in GitHub Desktop.
Save clemens/669b5552431541789716 to your computer and use it in GitHub Desktop.
Using Rails' Object#with_options with i18n to scope and DRY up translations
- with_options(:scope => 'foo') do |i18n|
p Some HTML
/ will actually look up the value of the key "foo.bar"
p = i18n.t('bar')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment