Skip to content
croaky edited this page Sep 13, 2010 · 28 revisions

Installation

Clearance is a Rails engine. It works with versions of Rails greater than 2.3.

In config/environment.rb:

config.gem "clearance", 
  :lib     => 'clearance', 
  :source  => 'http://gems.github.com', 
  :version => '0.8.8'

Vendor the gem:

rake gems:install
rake gems:unpack

Make sure the development database exists and run the generator:

script/generate clearance

A number of files will be created and instructions will be printed.

You may already have some of these files. Don’t worry. You’ll be asked if you want to overwrite them.

Run the migration:

rake db:migrate

Configure the host in the default url options for the mailer to generate URLs in emails.
In config/environments/test.rb, config/environments/cucumber.rb (if you’re running cucumber features) and config/environments/development.rb it can be:

config.action_mailer.default_url_options = { :host => 'localhost:3000' }

In production.rb it must be the actual host your application is deployed to.

In config/initializers/clearance.rb (Add this file if upgrading from earlier versions). Add or alter the following code to reflect the email address that messages from the clearance authentication system within your app will come from

Clearance.configure do |config|
  config.mailer_sender = '[email protected]'
end

Define root_url to something in your config/routes.rb:

map.root :controller => 'home'

Integration with Suspenders

Clearance is in Suspenders If you use it, you already have all the configuration.