No commit activity in last 3 years
No release in over 3 years
A rails plugin use redis to sort models on real time.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 3.1.0
>= 3.0.0
 Project Readme

ActsAsRrranking

Build Status Gem Version Code Climate Dependency Status

A rails plugin use redis to sort models on real time.

Example

class Player < ActiveRecord::Base
  acts_as_rrranking :ranking, score: :game_point
end

Arguments

name

the name of the ranking field

options

score the field which the models can be sorted by (default: :score)
id the identification field of the models (default: :id)

Helper Methods

Suppose the name is :ranking and the score field is :game_point then the following methods will be generated:

#current_ranking return the current ranking
#update_ranking(score) update the score to redis, also will be invoked in the after_save hook
::top_rankings(limit, offset) return the array of top ids
::top_ranking_player(limit, offset) return the array of top models