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:
parent
94d19ae567
commit
dad36f2fca
4 changed files with 3 additions and 4 deletions
|
@ -12,7 +12,6 @@ module Api
|
|||
before_action :require_public_data, :only => [:create, :update, :upload, :close, :subscribe, :unsubscribe]
|
||||
before_action :check_api_writable, :only => [:create, :update, :upload, :subscribe, :unsubscribe]
|
||||
before_action :check_api_readable, :except => [:create, :update, :upload, :download, :query, :subscribe, :unsubscribe]
|
||||
before_action(:only => [:index, :feed]) { |c| c.check_database_readable(true) }
|
||||
around_action :api_call_handle_error
|
||||
around_action :api_call_timeout, :except => [:upload]
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ class BrowseController < ApplicationController
|
|||
|
||||
before_action :authorize_web
|
||||
before_action :set_locale
|
||||
before_action(:except => [:query]) { |c| c.check_database_readable(true) }
|
||||
before_action -> { check_database_readable(true) }
|
||||
before_action :require_oauth
|
||||
around_action :web_timeout
|
||||
authorize_resource :class => false
|
||||
|
|
|
@ -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
|
||||
|
||||
##
|
||||
|
|
|
@ -7,7 +7,7 @@ class ChangesetsController < ApplicationController
|
|||
skip_before_action :verify_authenticity_token, :except => [:index]
|
||||
before_action :authorize_web
|
||||
before_action :set_locale
|
||||
before_action(:only => [:index, :feed]) { |c| c.check_database_readable(true) }
|
||||
before_action -> { check_database_readable(true) }, :only => [:index, :feed]
|
||||
|
||||
authorize_resource
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue