This may be a basic question, and I’m not even sure if it’s possible, but here goes.
If I have a event model which is composed of events, and the URLs are /events to see all, and /events/:id to see an individual event… Can I also do something like /events/:status to redirect to the index controller and show say, previous, inactive events and so on based on what that status is, but also preserve the /events/:id functionality?
So basically:
/events/17 would bring me to the 17th event created and /events/previous would bring me to a listing of all events that have come and gone.
Is this possible? if so, how would I setup the routes?
I tried:
match "/events/:status" => "events#index"
resources :events
but that just overrides the :id one, so I can no longer get to an individual event. I’m still learning all of the terminology of rails, so my searching abilities are a little limited.
Try this:
This assumes your status is of limit number, so you could define them all each in online manually.