HTTP action naming (ARCH6004)
Esta página aún no está disponible en tu idioma.
Key ruby.naming.controller-action-naming · Severity info · Category naming
For RESTful consistency, controller action names should match the semantics of the HTTP verb they handle. GET requests should map to index/show, POST to create; names that contradict the verb (a create on a GET) mislead readers.
Incorrect
Section titled “Incorrect”class ArticlesController < ApplicationController # GET /articles def create_list @articles = Article.all endendCorrect
Section titled “Correct”class ArticlesController < ApplicationController # GET /articles def index @articles = Article.all endendRename the action to the RESTful name that matches its HTTP verb (GET→index/show, POST→create).