(I'm very much a newbie, so forgive me if I'm leaving any details out.)
I'm trying to understand how to relate 3 resources in a RESTful way. The scenario I'm playing around with is a survey model. A survey has many questions, each question has many choices. The 3 resources are Surveys, Questions, Choices.
Example:
Nature Survey (survey) -- http://localhost:3000/surveys/1
What color is the sky? (question) -- http://localhost:3000/surveys/1/questions/1 red (choice) -- http://localhost:3000/surveys/1/questions/1/choices/1 green (choice) -- http://localhost:3000/surveys/1/questions/1/choices/2 blue (choice) -- http://localhost:3000/surveys/1/questions/1/choices/3
Which season is the coldest? (question) -- http://localhost:3000/surveys/1/questions/2 summer (choice) -- http://localhost:3000/surveys/1/questions/2/choices/1 spring (choice) -- http://localhost:3000/surveys/1/questions/2/choices/1 fall (choice) -- http://localhost:3000/surveys/1/questions/2/choices/1 winter (choice) -- http://localhost:3000/surveys/1/questions/2/choices/1
I've set up the models and added the belongs_to and has_many relationships. I believe I have the routing set up correctly: