我正在使用这个gem来排行榜:https://github.com/agoragames/leaderboard
当我使用普通排行榜时,它起作用了:
def index
highscore=Leaderboard.new('highscores')
1.upto(10) do |index|
highscore.rank_member("member_#{index}", Random.new.rand(1..100))
end
end然而,当我使用其他类型的排行榜时,它不起作用:
def index
highscore=TieRankingLeaderboard.new('highscores')
1.upto(10) do |index|
highscore.rank_member("member_#{index}", Random.new.rand(1..100))
end
end我得到错误:uninitialized constant ApplicationController::TieRankingLeaderboard
这意味着Rails没有检测到这个类。
发布于 2016-03-17 02:12:48
希望能帮助到其他人。我花了相当多的时间来弄清楚这件小事。
你需要把你的
require 'tie_ranking_leaderboard' 在application.rb中
https://stackoverflow.com/questions/36037539
复制相似问题