app/models/tr8n/translation_key_lock.rb in tr8n-3.1.1 vs app/models/tr8n/translation_key_lock.rb in tr8n-3.1.2

- old
+ new

@@ -1,7 +1,7 @@ #-- -# Copyright (c) 2010-2011 Michael Berkovich +# Copyright (c) 2010-2011 Michael Berkovich, tr8n.net # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, @@ -31,10 +31,10 @@ belongs_to :translator, :class_name => "Tr8n::Translator" alias :key :translation_key def self.find_or_create(translation_key, language) - lock = find(:first, :conditions => ["translation_key_id = ? and language_id = ?", translation_key.id, language.id]) + lock = where("translation_key_id = ? and language_id = ?", translation_key.id, language.id).first lock || create(:translation_key => translation_key, :language => language) end def self.for(translation_key, language) Tr8n::Cache.fetch("translation_key_lock_#{language.locale}_#{translation_key.key}") do