Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hallelujah/360661 to your computer and use it in GitHub Desktop.
Save hallelujah/360661 to your computer and use it in GitHub Desktop.
diff --git a/lib/gettext_i18n_rails/backend.rb b/lib/gettext_i18n_rails/backend.rb
index b27344b..2932262 100644
--- a/lib/gettext_i18n_rails/backend.rb
+++ b/lib/gettext_i18n_rails/backend.rb
@@ -20,7 +20,7 @@ module GettextI18nRails
_(flat_key)
else
if self.class.translate_defaults
- options[:default].to_a.each do |default|
+ Array.wrap(options[:default]).each do |default|
#try the more specific key first e.g. 'activerecord.errors.my custom message'
flat_key = flatten_key default, options
return FastGettext._(flat_key) if FastGettext.key_exist?(flat_key)
@@ -44,4 +44,4 @@ module GettextI18nRails
scope.empty? ? key.to_s : "#{scope*'.'}.#{key}"
end
end
-end
\ No newline at end of file
+end
@grosser
Copy link

grosser commented Apr 9, 2010

NoMethodError: undefined method `wrap' for Array:Class ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment