0

假设我有Course that has_many Students。我在课程中也有def top_student 。我现在在Course顶部有一个 active_scaffold ,但是如果我将top_student添加为一列,它会显示 #,但没有链接。我想要一个指向优秀学生的学生的链接。有什么办法可以做到这一点?

4

1 回答 1

0
class Course < ActiveRecord::Base
  # Class method
  def self.top_student
    # Some logic
  end
end

它应该是:

<%=link_to "Top Student", Course.top_student %>
于 2009-10-07T19:55:56.903 回答