Browse Source

Merge pull request #79 from tenstartups/master

Removed Rails 5 deprecation warnings
master
Dmitrii Golub 9 years ago
parent
commit
6245f9d07c
  1. 5
      app/controllers/devise/two_factor_authentication_controller.rb
  2. 4
      lib/two_factor_authentication/controllers/helpers.rb
  3. 4
      spec/rails_app/app/controllers/home_controller.rb

5
app/controllers/devise/two_factor_authentication_controller.rb

@ -1,6 +1,11 @@
class Devise::TwoFactorAuthenticationController < DeviseController class Devise::TwoFactorAuthenticationController < DeviseController
if Rails::VERSION::MAJOR >= 4
prepend_before_action :authenticate_scope!
before_action :prepare_and_validate, :handle_two_factor_authentication
else
prepend_before_filter :authenticate_scope! prepend_before_filter :authenticate_scope!
before_filter :prepare_and_validate, :handle_two_factor_authentication before_filter :prepare_and_validate, :handle_two_factor_authentication
end
def show def show
end end

4
lib/two_factor_authentication/controllers/helpers.rb

@ -4,8 +4,12 @@ module TwoFactorAuthentication
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
if Rails::VERSION::MAJOR >= 4
before_action :handle_two_factor_authentication
else
before_filter :handle_two_factor_authentication before_filter :handle_two_factor_authentication
end end
end
private private

4
spec/rails_app/app/controllers/home_controller.rb

@ -1,5 +1,9 @@
class HomeController < ApplicationController class HomeController < ApplicationController
if Rails::VERSION::MAJOR >= 4
before_action :authenticate_user!, only: :dashboard
else
before_filter :authenticate_user!, only: :dashboard before_filter :authenticate_user!, only: :dashboard
end
def index def index
end end

Loading…
Cancel
Save