Last active
December 11, 2015 13:08
-
-
Save NIA/4605018 to your computer and use it in GitHub Desktop.
This file contains 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
resources :doctors do | |
get 'new_schedule', :on => :member | |
end | |
resources :schedules do | |
get 'new_appointment', :on => :member | |
end | |
resources :appointments | |
# With this /doctors/123/new_schedule will map to DoctorsController#new_schedule | |
# and /schedules/321/new_appointment will map to SchedulesController#new_appointment | |
# And all other normal routes (show, edit, delete) will be simple in form :controller/:id/:action: | |
# | |
# doctors/123/show to show doctor with id 123 | |
# schedules/321/edit to edit schedule with id 321 (we dont't need the ID of doctor to find it, so why nesting?) | |
# appointments/444/delete to delete appointment with id 444 | |
# | |
# If you still want to show to user the fact of nesting this, you can show this on your page, like when you | |
# visit appointment 444, you can show something like... | |
# Doctor <name> > Schedule <title> > Apppointment <title> | |
# ... in your page | |
No, in this case from the point of routes all three resourses are independent and only need one parameter for URL generation.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
we are parsing doctor through schedule?