Sha256: 35fca6692d17f8ec7cf4e0d8e4014af893de85621648344beebf4160a841718d

Contents?: true

Size: 1.15 KB

Versions: 16

Compression:

Stored size: 1.15 KB

Contents

require "clearance"
require "rails/engine"

module Clearance
  # Makes Clearance behavior available to Rails apps on initialization. By using
  # a Rails Engine rather than a Railtie, Clearance can automatically expose its
  # own routes and views to the hosting application.
  #
  # Requiring `clearance` (likely by having it in your `Gemfile`) will
  # automatically require the engine. You can opt-out of Clearance's internal
  # routes by using {Configuration#routes=}. You can override the Clearance
  # views by running `rails generate clearance:views`.
  #
  # In addition to providing routes and views, the Clearance engine:
  #
  # * Ensures `password` and `token` parameters are filtered out of Rails logs.
  # * Mounts the {RackSession} middleware in the appropriate location
  # * Reloads classes referenced in your {Configuration} on every request in
  #   development mode.
  #
  class Engine < Rails::Engine
    initializer "clearance.filter" do |app|
      app.config.filter_parameters += [:password, :token]
    end

    config.app_middleware.use(Clearance::RackSession)

    config.to_prepare do
      Clearance.configuration.reload_user_model
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
clearance-2.7.0 lib/clearance/engine.rb
clearance-2.6.2 lib/clearance/engine.rb
clearance-2.6.1 lib/clearance/engine.rb
clearance-2.6.0 lib/clearance/engine.rb
clearance-2.5.0 lib/clearance/engine.rb
clearance-2.4.0 lib/clearance/engine.rb
clearance-2.3.1 lib/clearance/engine.rb
clearance-2.3.0 lib/clearance/engine.rb
clearance-2.2.1 lib/clearance/engine.rb
clearance-2.2.0 lib/clearance/engine.rb
clearance-2.1.0 lib/clearance/engine.rb
clearance-2.0.0 lib/clearance/engine.rb
clearance-2.0.0.beta2 lib/clearance/engine.rb
clearance-2.0.0.beta1 lib/clearance/engine.rb
clearance-1.17.0 lib/clearance/engine.rb
clearance-1.16.2 lib/clearance/engine.rb