Skip to content

Instantly share code, notes, and snippets.

@liangzan
Created September 7, 2010 03:44
Show Gist options
  • Save liangzan/567837 to your computer and use it in GitHub Desktop.
Save liangzan/567837 to your computer and use it in GitHub Desktop.
# lib/formtastic/i18n.rb
def translate(*args)
key = args.shift.to_sym
options = args.extract_options!
options.reverse_merge!(:default => DEFAULT_VALUES[key])
options[:scope] = [DEFAULT_SCOPE, options[:scope]].flatten.compact
::I18n.translate(key, *(args << options))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment