Class: RuboCop::Cop::Betterment::RenderStatus

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Includes:
Utils::ResponseStatus
Defined in:
lib/rubocop/cop/betterment/render_status.rb

Constant Summary collapse

MSG =
<<~MSG.gsub(/\s+/, " ")
  Did you forget to specify an HTTP status code? The default is `status: :ok`, which might
  be inappropriate in this situation. Rendering after a POST, PUT, PATCH or DELETE request
  typically represents an error (e.g. `status: :unprocessable_entity`).
MSG

Constants included from Utils::ResponseStatus

Utils::ResponseStatus::UNSAFE_ACTIONS

Instance Method Summary collapse

Instance Method Details

#on_def(node) ⇒ Object



19
20
21
22
23
# File 'lib/rubocop/cop/betterment/render_status.rb', line 19

def on_def(node)
  each_offense(node, :render) do |responder|
    infer_status(responder)
  end
end