I have Students
, each of which has a standard :id
but they also have a :student_number
which is unique. I would like to be able to find a view a student given only their :student_number
Here's the route I have now:
resources :students do
collection do
get 'find_by_num'
end
end
This works, but it feels a little strange, creating a 'collection' for what I know will be a single result--that is, a 'member'. At the same time, members expect :id
and I don't have one.
What would be the accepted, RESTful way of doing this?
I searched for an existing answer and found this question, but I'm interested in the route itself.
Thanks for any help!