Permalink
Browse files

Fixed bug when adding a new user:

- Language returns the default locale if preferences is nil.
- Language setter retries mergin hashes setting `self.preferences = { }`.
  • Loading branch information...
Francesc Esplugas
Francesc Esplugas committed Feb 19, 2010
1 parent c80ea53 commit 34d35049bde6ae31b51d29e861c3bc22beeb398a
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/typus/user.rb
View
@@ -106,11 +106,16 @@ def is_root?
def language
preferences[:locale]
+ rescue
+ I18n.default_locale.to_s
end
def language=(locale)
options = { :locale => locale }
self.preferences.merge!(options)
+ rescue
+ self.preferences = { }
+ retry
end
protected

0 comments on commit 34d3504

Please sign in to comment.