If you want to create an extra attribute based on SQL query with ActiveRecord you can use the following:
@games = Game.select("*, ABS(#{@profile.level} - level) AS level_difference")
Then in your Ruby code you can refer to things this way:
@games.first.level_difference # => 16