diff options
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index e5ae7ea..d87f988 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -23,17 +23,23 @@ class User < ActiveRecord::Base self.permissions ||= Server.first.default_user_permissions end - def scores - self.statistics.find_by_name(:score) + def set_remote_username(game, data) + remote = self.remote_usernames.where(:game => game).first + if remote.nil? + self.remote_usernames.create(game: game, value: data) + else + remote.value = data + remote.save + end end - def find_remote_username(game) + def get_remote_username(game) obj = self.remote_usernames.where(:game => game).first if obj.nil? if game.parent.nil? return nil else - return find_remote_username(game.parent) + return get_remote_username(game.parent) end else return obj.value |