Skip to content

Instantly share code, notes, and snippets.

@johncblandii
Created April 27, 2012 18:18
Show Gist options
  • Save johncblandii/2511517 to your computer and use it in GitHub Desktop.
Save johncblandii/2511517 to your computer and use it in GitHub Desktop.
Leaderboard initializer
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