我的模型中有以下方法:
def self.set_bad_recommedation_size(rating_set)
bad = Rating.where(rating_set: rating_set).where(label: 'Bad').count
total = Rating.where(rating_set: rating_set).count
percentage_bad = (bad.to_f/total.to_f * 100)
return bad, total, percentage_bad
end
在我看来,如何调用变量 bad、total、percentage_bad。我想要的是:
<%= "#{Model.set_bad_recommedation_size(rating_set).bad}/#{Model.set_bad_recommedation_size(rating_set).total"%>