开发者

Displaying links on columns mapped to custom attributes

Say I have Course that has_many Students. I also have de开发者_StackOverflow社区f top_student in the Course class. I now have an active_scaffold on top of Course, but if I add top_student as a column it show shows #, but no link. I'd like a link to the Student who is the Top Student. Any way to make this happen?


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

it should be:

<%=link_to "Top Student", Course.top_student %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜