Sha256: 91f5091e2e2d59354861b87ef4b90d7a40530c8c67cc85cde407245c3b53959a

Contents?: true

Size: 1.08 KB

Versions: 18

Compression:

Stored size: 1.08 KB

Contents

require "rodauth/rails/middleware"
require "rodauth/rails/controller_methods"
require "rodauth/rails/test"

require "rails"

module Rodauth
  module Rails
    class Railtie < ::Rails::Railtie
      initializer "rodauth.middleware", after: :load_config_initializers do |app|
        if Rodauth::Rails.middleware?
          app.middleware.use Rodauth::Rails::Middleware
        end
      end

      initializer "rodauth.controller" do
        ActiveSupport.on_load(:action_controller) do
          include Rodauth::Rails::ControllerMethods
        end
      end

      initializer "rodauth.test" do
        # Rodauth uses RACK_ENV to set the default bcrypt hash cost
        ENV["RACK_ENV"] = "test" if ::Rails.env.test?

        if ActionPack.version >= Gem::Version.new("5.0")
          ActiveSupport.on_load(:action_controller_test_case) do
            include Rodauth::Rails::Test::Controller
          end
        else
          ActionController::TestCase.include Rodauth::Rails::Test::Controller
        end
      end

      rake_tasks do
        load "rodauth/rails/tasks.rake"
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rodauth-rails-1.8.0 lib/rodauth/rails/railtie.rb
rodauth-rails-1.7.1 lib/rodauth/rails/railtie.rb
rodauth-rails-1.7.0 lib/rodauth/rails/railtie.rb
rodauth-rails-1.6.4 lib/rodauth/rails/railtie.rb
rodauth-rails-1.6.3 lib/rodauth/rails/railtie.rb
rodauth-rails-1.6.2 lib/rodauth/rails/railtie.rb
rodauth-rails-1.6.1 lib/rodauth/rails/railtie.rb
rodauth-rails-1.6.0 lib/rodauth/rails/railtie.rb
rodauth-rails-1.5.5 lib/rodauth/rails/railtie.rb
rodauth-rails-1.5.4 lib/rodauth/rails/railtie.rb
rodauth-rails-1.5.2 lib/rodauth/rails/railtie.rb
rodauth-rails-1.5.1 lib/rodauth/rails/railtie.rb
rodauth-rails-1.5.0 lib/rodauth/rails/railtie.rb
rodauth-rails-1.4.2 lib/rodauth/rails/railtie.rb
rodauth-rails-1.4.1 lib/rodauth/rails/railtie.rb
rodauth-rails-1.4.0 lib/rodauth/rails/railtie.rb
rodauth-rails-1.3.1 lib/rodauth/rails/railtie.rb
rodauth-rails-1.3.0 lib/rodauth/rails/railtie.rb