Ruby on Rails Developer Question: Download Questions PDF
Tell us what is the purpose of the resources method in the code snippet below?
![Ruby on Rails Developer Interview Answer Ruby on Rails Developer Interview Question](https://globalguideline.com/public/images/interview/32.png)
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
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
Download Ruby on Rails Developer Interview Questions And Answers
PDF
Previous Question | Next Question |
Tell me what’s the difference between destroy and delete? | Tell us what are some advantages of using Ruby on Rails? |