What is the purpose of the resources method in the code snippet below?

Technology CommunityCategory: Ruby on RailsWhat is the purpose of the resources method in the code snippet below?
VietMX Staff asked 3 years ago
Problem

Consider:

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