Permalink
Browse files

tweaked new set_translations code a bit

  • Loading branch information...
1 parent 315ae9d commit 612292fc206c890b4afa9f9054bfa92e0d95685c @joshmh joshmh committed May 1, 2009
Showing with 2 additions and 4 deletions.
  1. +2 −4 lib/globalize/model/active_record/translated.rb
@@ -141,10 +141,8 @@ def translated_locales
def set_translations options
options.keys.each do |key|
- unless translation = globalize_translations.find_by_locale(key.to_s)
- translation = globalize_translations.create!(:locale => key.to_s)
- end
-
+ translation = globalize_translations.find_by_locale(key.to_s) ||
+ globalize_translations.build(:locale => key.to_s)
translation.update_attributes!(options[key])
end
end

0 comments on commit 612292f

Please sign in to comment.