From 6cefd809125fd3b1e5114bee2747292da0b1ea00 Mon Sep 17 00:00:00 2001 From: Ben Anderson Date: Sat, 19 Jul 2025 00:05:48 +1200 Subject: [PATCH] Convert remaining before_filter cases to before_action before_filter is deprecated, and removed in Rails 5.1 --- app/controllers/accounts/requests_controller.rb | 2 +- app/controllers/application_controller.rb | 10 +++++----- app/controllers/contest_relations_controller.rb | 2 +- app/controllers/groups/problem_sets_controller.rb | 2 +- app/controllers/importers/problem_series_controller.rb | 2 +- app/controllers/problems/test_cases_controller.rb | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/controllers/accounts/requests_controller.rb b/app/controllers/accounts/requests_controller.rb index 3d1bf36a..7345b226 100644 --- a/app/controllers/accounts/requests_controller.rb +++ b/app/controllers/accounts/requests_controller.rb @@ -1,5 +1,5 @@ class Accounts::RequestsController < ApplicationController - before_filter do + before_action do raise Pundit::NotAuthorizedError unless user_signed_in? end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cc696d42..9979a6de 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -6,11 +6,11 @@ class ApplicationController < ActionController::Base protect_from_forgery - before_filter :update_last_seen_at - before_filter :update_contest_checkin - before_filter :read_settings - before_filter :check_su_loss - before_filter :configure_permitted_parameters, if: :devise_controller? + before_action :update_last_seen_at + before_action :update_contest_checkin + before_action :read_settings + before_action :check_su_loss + before_action :configure_permitted_parameters, if: :devise_controller? # helper ApplicationHelper # helper ProblemsHelper diff --git a/app/controllers/contest_relations_controller.rb b/app/controllers/contest_relations_controller.rb index c1206f37..8579cdbf 100644 --- a/app/controllers/contest_relations_controller.rb +++ b/app/controllers/contest_relations_controller.rb @@ -1,6 +1,6 @@ class ContestRelationsController < ApplicationController before_action :authenticate_user! - before_filter :find_contest_relation + before_action :find_contest_relation def destroy authorize @contest_relation, :destroy? diff --git a/app/controllers/groups/problem_sets_controller.rb b/app/controllers/groups/problem_sets_controller.rb index 2fe522e9..4ba127f7 100644 --- a/app/controllers/groups/problem_sets_controller.rb +++ b/app/controllers/groups/problem_sets_controller.rb @@ -1,7 +1,7 @@ class Groups::ProblemSetsController < ApplicationController layout "group" - before_filter do + before_action do @group = Group.find(params[:group_id]) end diff --git a/app/controllers/importers/problem_series_controller.rb b/app/controllers/importers/problem_series_controller.rb index 0d4f769c..a5d3fadf 100644 --- a/app/controllers/importers/problem_series_controller.rb +++ b/app/controllers/importers/problem_series_controller.rb @@ -1,5 +1,5 @@ class Importers::ProblemSeriesController < ApplicationController - before_filter do + before_action do raise Pundit::NotAuthorizedError unless current_user.is_superadmin? raise ActiveRecord::RecordNotFound if importer.nil? end diff --git a/app/controllers/problems/test_cases_controller.rb b/app/controllers/problems/test_cases_controller.rb index 00d9a247..9efddbe2 100644 --- a/app/controllers/problems/test_cases_controller.rb +++ b/app/controllers/problems/test_cases_controller.rb @@ -1,7 +1,7 @@ class Problems::TestCasesController < ApplicationController layout "problem" - before_filter do + before_action do @problem = Problem.find(params[:problem_id]) end