0
我想通過該模型中的方法對結果進行排序,但模型方法需要一些參數,這就是我遇到問題的地方。 我的模式被稱爲事件,我試圖用Ruby on Rails 4 - 使用模型方法用參數排序
Event.all.sort_by(&:user_score("2", "51.4980749", "10.8119977"))
方法,用戶需要得分一些參數
def user_score user_id, latitude, longitude
return 0
end
回報當然0只是爲了測試它,但它已經失敗時,我呼叫功能:
SyntaxError: (irb):12: syntax error, unexpected '(', expecting ')'
...Event.all.sort_by(&:user_score("2", "51.4980749", ...
我在做什麼錯?