Skip to content
This repository has been archived by the owner on May 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #96 from mbryja/before_action
Browse files Browse the repository at this point in the history
replacing before_filter with before action for rails 5.1+ support
  • Loading branch information
jenikm committed Nov 19, 2020
2 parents 1af44bb + 9802a51 commit 54162cb
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/controllers/landable/api/access_tokens_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Landable
module Api
class AccessTokensController < ApiController
skip_before_filter :require_author!, only: [:create]
skip_before_action :require_author!, only: [:create]

def show
respond_with find_own_access_token
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/landable/api/assets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Landable
module Api
class AssetsController < ApiController
# filters
before_filter :load_asset, except: [:create, :index]
before_action :load_asset, except: [:create, :index]

# RESTful methods
def create
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/landable/api/page_revisions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Landable
module Api
class PageRevisionsController < ApiController
skip_before_filter :require_author!, if: proc { |c| c.action_name == 'show' && c.request.format == :html }
skip_before_action :require_author!, if: proc { |c| c.action_name == 'show' && c.request.format == :html }

def index
page = Page.find(params[:page_id])
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/landable/api/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Landable
module Api
class PagesController < ApiController
# filters
before_filter :load_page, except: [:create, :index, :preview]
before_action :load_page, except: [:create, :index, :preview]

# RESTful methods
def create
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/landable/api/templates_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Landable
module Api
class TemplatesController < ApiController
# filters
before_filter :load_template, except: [:create, :index, :preview]
before_action :load_template, except: [:create, :index, :preview]

# RESTful methods
def create
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/landable/api/themes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Landable
module Api
class ThemesController < ApiController
# filters
before_filter :load_theme, except: [:create, :index, :preview]
before_action :load_theme, except: [:create, :index, :preview]

# RESTful methods
def create
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/landable/api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ApiController < ApplicationController
# tracking is not necessary for API calls
skip_around_action :track_with_landable!, raise: false

before_filter :require_author!
before_action :require_author!

respond_to :json
self.responder = Landable::ApiResponder
Expand Down
2 changes: 1 addition & 1 deletion lib/landable/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Landable
module VERSION
MAJOR = 1
MINOR = 99
PATCH = 2
PATCH = 3

STRING = [MAJOR, MINOR, PATCH].compact.join('.')
end
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/landable/api_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe Landable::ApiController, json: true do
controller(Landable::ApiController) do
skip_before_filter :require_author!, except: [:index]
skip_before_action :require_author!, except: [:index]

def index
render nothing: true
Expand Down

0 comments on commit 54162cb

Please sign in to comment.