Skip to content

Commit

Permalink
Fix deprecation warnings
Browse files Browse the repository at this point in the history
Replaces `before_filter` with `before_action`.

DEPRECATION WARNING: before_filter is deprecated and will be removed in Rails 5.1. Use before_action instead.

[fixes #773]
  • Loading branch information
daande authored and tute committed Jan 2, 2016
1 parent 61eb6aa commit 27ee4af
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/controllers/doorkeeper/applications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module Doorkeeper
class ApplicationsController < Doorkeeper::ApplicationController
layout 'doorkeeper/admin'

before_filter :authenticate_admin!
before_filter :set_application, only: [:show, :edit, :update, :destroy]
before_action :authenticate_admin!
before_action :set_application, only: [:show, :edit, :update, :destroy]

def index
@applications = Application.all
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/doorkeeper/authorizations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Doorkeeper
class AuthorizationsController < Doorkeeper::ApplicationController
before_filter :authenticate_resource_owner!
before_action :authenticate_resource_owner!

def new
if pre_auth.authorizable?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Doorkeeper
class AuthorizedApplicationsController < Doorkeeper::ApplicationController
before_filter :authenticate_resource_owner!
before_action :authenticate_resource_owner!

def index
@applications = Application.authorized_for(current_resource_owner)
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/protected_resources_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def show
describe 'doorkeeper authorize filter' do
context 'accepts token code specified as' do
controller do
before_filter :doorkeeper_authorize!
before_action :doorkeeper_authorize!

def index
render text: 'index'
Expand Down Expand Up @@ -58,7 +58,7 @@ def index

context 'defined for all actions' do
controller do
before_filter :doorkeeper_authorize!
before_action :doorkeeper_authorize!

include ControllerActions
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class FullProtectedResourcesController < ApplicationController
before_filter -> { doorkeeper_authorize! :write, :admin }, only: :show
before_filter :doorkeeper_authorize!, only: :index
before_action -> { doorkeeper_authorize! :write, :admin }, only: :show
before_action :doorkeeper_authorize!, only: :index

def index
render text: 'index'
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/app/controllers/metal_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class MetalController < ActionController::Metal
include ActionController::Head
include Doorkeeper::Rails::Helpers

before_filter :doorkeeper_authorize!
before_action :doorkeeper_authorize!

def index
self.response_body = { ok: true }.to_json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class SemiProtectedResourcesController < ApplicationController
before_filter :doorkeeper_authorize!, only: :index
before_action :doorkeeper_authorize!, only: :index

def index
render text: 'protected index'
Expand Down

0 comments on commit 27ee4af

Please sign in to comment.