[英]Rails Leaderboard Gem not working for TieRankingLeaderboard
我正在將此寶石用於排行榜: 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沒有檢測到該類。
希望應該幫助別人。 我浪費了很多時間弄清楚這個小東西。
你需要放
require 'tie_ranking_leaderboard'
在application.rb中
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.