I have a model College that has a show action in its controller.
So I can access /colleges/1 and the view will display info about college with id 1.
In that view, I have some tabs ‘students’, ‘contests’, etc.
My intent is that when user clicks on ‘students’, the view shows students in that college.
And when user clicks on ‘contests’, the view shows contests scheduled in that college.
What is the best way to support this ?
1. Custom actions such as /colleges/1/showstudents and /colleges/1/showcontests ?
2. Show action with parameters, such as /colleges/1/show?type=students, ?type=contests ?
I was thinking #2, and in the view I can do <% if params[:type] <=> "contests" .. %>
but how do I put a link in the tab for ‘contests’ ?
It didn’t seem right.
So what is the best practice for this scenario ?
Thanks,
So I think that you should have a college_controller.rb and then in there just
have a students method which will evaluate a college parameter and display students from that college ie.