Ok, so here is an example script. There is a student resource resources :students, and students have and belong to many collections: resources :clubs, resources :majorsetc.
This way we can easily customize our routes ...
resources :clubs do
resources :students
end
resources :majors do
resources :students
end
resources :students do
resources :clubs
resources :majors
end
which generates us a bunch of standard RESTful routes
- / clubs
- / clubs /: identifier
- / clubs /: club_id / students
- / clubs /: club_id / students /: id of majors
- / majors /: identifier
- / majors /: major_id / students
- / majors /: major_id / students /: identifier
- / students
- / students /: identifier
- / students /: student_id / clubs
- / students /: student_id / clubs /: identifier
- / students /: student_id / majors
- / students /: student_id / majors /: identifier
, . REST, ?
/majors/:major_id/students/:id "". id: StudentsController#destroy, . ! , , DELETE /students/:student_id/majors/:id, UnderwaterBasketweaving ... !
destroyController, MajorsController StudentsController club_id major_id student_id, , "" "GraduatingClasses" .. , , ... , . , , ... "" ...
? , make_resourceful resource_controller, UnderwaterBasketweaving Joe Majors JohnDoe UnderwaterBasketweaving. , , "".
, ? UnderwaterBasketweaving → Joe but UnderwaterBasketweaving + Joe , , , Joe, UnderwaterBasketweaving, , ? , , , (MVC RV... "" , , ). , ; ...
, , ...?
... major.student.delete... "" ActiveRecord , "" , "" AR?