app/models/tr8n/language_user.rb in tr8n-3.1.1 vs app/models/tr8n/language_user.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,
@@ -32,21 +32,21 @@
# users may choose to switch to a language without becoming translators
# once user becomes a translator, this record will be associated with both for ease of use
# when users get promoted, they are automatically get associated with a language and marked as translators
def self.find_or_create(user, language)
- lu = find(:first, :conditions => ["user_id = ? and language_id = ?", user.id, language.id])
+ lu = where("user_id = ? and language_id = ?", user.id, language.id).first
lu || create(:user_id => user.id, :language_id => language.id)
end
def self.check_default_language_for(user)
find_or_create(user, Tr8n::Config.default_language)
end
def self.languages_for(user)
return [] unless user.id
check_default_language_for(user)
- find(:all, :conditions => ["user_id = ?", user.id], :order => "updated_at desc")
+ where("user_id = ?", user.id).order("updated_at desc")
end
def self.create_or_touch(user, language)
return unless user.id
lu = Tr8n::LanguageUser.find_or_create(user, language)