-
-
Save erithmetic/3948186 to your computer and use it in GitHub Desktop.
How do I keep all of these routes, but also make them available under a scope?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I have read http://api.rubyonrails.org/classes/ActionDispatch/Routing/Mapper/Resources.html#method-i-resources | |
# and remain clueless. | |
MyApp::Application.routes.draw do | |
resources :blogs do | |
resources :comments | |
end | |
# then imagine tons of routing below this | |
end | |
# So above, we can see we have routes with paths: | |
# /blogs | |
# /blogs/comments | |
# However, I want to create snapshots of the database periodically and make them | |
# available via: | |
# | |
# /snapshots/:snapshot_id/blogs | |
# /snapshots/:snapshot_id/blogs/comments | |
# The URLs above should go to the same controllers/actions as my original | |
# routes file defines. | |
# | |
# Also, the original /blogs and /blogs/comments should be available without the snapshot stuff. | |
# | |
# My idea here is that application_controller.rb will figure out when a | |
# snapshot is being requested, and switch the DB accordingly. | |
# So, I know I'm dense. How do I do that? Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment