Add and apply Rails/HttpStatus rubocop rule
We were already using it in most places. Since rubocop-rails 2.11.0, this rule also detects offenses when using the `head` method, which we were using with a plain `404`.
This commit is contained in:
@@ -245,6 +245,9 @@ Rails/HasManyOrHasOneDependent:
|
|||||||
Enabled: true
|
Enabled: true
|
||||||
Severity: refactor
|
Severity: refactor
|
||||||
|
|
||||||
|
Rails/HttpStatus:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Rails/InverseOf:
|
Rails/InverseOf:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Exclude:
|
Exclude:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class DirectUploadsController < ApplicationController
|
|||||||
attachment_url: @direct_upload.relation.attachment.url }
|
attachment_url: @direct_upload.relation.attachment.url }
|
||||||
else
|
else
|
||||||
render json: { errors: @direct_upload.errors[:attachment].join(", ") },
|
render json: { errors: @direct_upload.errors[:attachment].join(", ") },
|
||||||
status: 422
|
status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ class PagesController < ApplicationController
|
|||||||
render action: params[:id]
|
render action: params[:id]
|
||||||
end
|
end
|
||||||
rescue ActionView::MissingTemplate
|
rescue ActionView::MissingTemplate
|
||||||
head 404, content_type: "text/html"
|
head :not_found, content_type: "text/html"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user