Rails 2.3.11
In Rails, when you generate a scaffold, it creates index, show, edit, and new views for it, as well as a host of methods in the associated controller. How do I add my own view to the model?
For my Events model, I’d like to add /events/past to display all events that have already happened. When I just add
def past
end
to events_controller and create /views/events/past.html.erb, then go to site.com/events/past, it looks for an event with the ID “past”.
If I add map.match '/events/past' => 'events#past' to routes.rb, it says I must specify the controller.
If that’s changed to map.match '/events/past' => 'events#past', :controller => :events, I’m back with the same “Couldn’t find Event with ID=past” error.
Thanks for helping out someone who’s new to Rails!
Since this is the old Rails, I believe you must use: