Sha256: d466a9a9a2e5a201f882cc8e735186b4a72acea46e78170473b50689a24125f1

Contents?: true

Size: 945 Bytes

Versions: 9

Compression:

Stored size: 945 Bytes

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?

        ActiveSupport.on_load(:action_controller_test_case) do
          include Rodauth::Rails::Test::Controller
        end
      end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rodauth-rails-1.15.2 lib/rodauth/rails/railtie.rb
rodauth-rails-1.15.1 lib/rodauth/rails/railtie.rb
rodauth-rails-1.15.0 lib/rodauth/rails/railtie.rb
rodauth-rails-1.14.0 lib/rodauth/rails/railtie.rb
rodauth-rails-1.13.0 lib/rodauth/rails/railtie.rb
rodauth-rails-1.12.0 lib/rodauth/rails/railtie.rb
rodauth-rails-1.11.0 lib/rodauth/rails/railtie.rb
rodauth-rails-1.10.0 lib/rodauth/rails/railtie.rb
rodauth-rails-1.9.0 lib/rodauth/rails/railtie.rb