Created
April 27, 2012 18:18
-
-
Save johncblandii/2511517 to your computer and use it in GitHub Desktop.
Leaderboard initializer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
rails_env = Rails.env | |
# Load the redis.yml configuration file | |
redis_config = YAML.load_file(Rails.root + 'config/leaderboard_redis.yml')[rails_env] | |
# Connect to Redis using the redis_config host and port | |
if redis_config | |
redis = Redis.new(host: redis_config['host'], port: redis_config['port']) | |
redis_options = {:redis_connection => redis} | |
HIGHSCORE_LB = Leaderboard.new('highscores', Leaderboard::DEFAULT_OPTIONS, redis_options) | |
end | |
rescue Exception=>ex | |
Rails.logger.error ex.message | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment