I want to be able to group similar actions under one controller to keep things neat and clean.
For example, if I have a Game
model, and I currently have:
resources :games do
get 'schedule/previous', to: "Games#previous"
get 'schedule/upcoming', to: "Games#upcoming"
get 'schedule/calendar', to: "Games#calendar"
end
These obviously get more and more unweildy, especially because I have a bunch of other actions in my GamesController
. How can I move these to a new controller (or otherwise organize them more cleanly)?
If possible I'd like to put the new "Schedule
" controller under app/controllers/games/schedule_controller.rb
or something like that.
I tried to do this using namespaces, scopes, and resources (and most of the combinations of two of those) and couldn't figure it out.
Aucun commentaire:
Enregistrer un commentaire