Use a lambda in order to pass parameters in before_actions

This avoid calling methods on a new instance of the controller, and
therefore allows these methods to be marked as private.

As a bonus, rubocop can now parse them and warn when they refer to
actions that don't exist in the controller.
This commit is contained in:
Andy Allan 2019-03-20 15:07:33 +01:00
parent 94d19ae567
commit dad36f2fca
4 changed files with 3 additions and 4 deletions

View file

@ -4,7 +4,7 @@ class ChangesetCommentsController < ApplicationController
authorize_resource
before_action(:only => [:index]) { |c| c.check_database_readable(true) }
before_action -> { check_database_readable(true) }
around_action :web_timeout
##