views:

21

answers:

1

Say I have Course that has_many Students. I also have def 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?

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

it should be:

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