Ruby on Rails Developer Question:

Tell us what is the purpose of the resources method in the code snippet below?

Ruby on Rails Developer Interview Question
Ruby on Rails Developer Interview Question

Answer:

resources :posts do
member do
get ‘messages’
end
collection do
post ‘bulk_upload'
end
end
Defining routes with the “resources” method automatically generates routes for the seven standard RESTful actions:

☛ GET /messages
☛ POST /messages
☛ GET /messages/new
☛ GET /messages/:id/edit
☛ GET /messages/:id
☛ PATCH/PUT /messages/:id
☛ DELETE /messages/:id


Previous QuestionNext Question
Tell me what’s the difference between destroy and delete?Tell us what are some advantages of using Ruby on Rails?