-
-
Notifications
You must be signed in to change notification settings - Fork 465
Organization
Clearance works by mixing behavior into tests, controllers, and models. For any file that you do not want to overwrite, include the corresponding Clearance module. They are namespaced exactly like the directory structure of a Rails app.
Application controller example:
class ApplicationController < ActionController::Base include Clearance::App::Controllers::ApplicationController endUser model example:
class User < ActiveRecord::Base include Clearance::App::Models::User endUser test example:
class UserTest < Test::Unit::TestCase include Clearance::Test::Unit::UserTest endThe generator will also create a migration to add a “users” table and run it. If the table already exists in the database, the migration will just add fields and indexes that are missing and required by Clearance. If the migration fails, the generator will revert all changes back.
Clearance will add these routes to your routes.rb:
map.resources :users, :has_one => [:password, :confirmation] map.resource :session map.resources :passwordsPlease note that Clearance depends on root_url, so please make sure that it is defined to something in your config/routes.rb:
map.root :controller => ‘home’Please note that Clearance depends on root_url, so please make sure that it is defined to something in your config/routes.rb:
map.root :controller => ‘users’, :action => ‘new’You need to define HOST constant in your environments files. In config/environments/test.rb and config/environments/development.rb it can be:
HOST = “localhost”While in config/environments/production.rb it must be the actual host your application is deployed to because the constant is used by mailers to generate URLs in emails.
In config/environment.rb:
DO_NOT_REPLY = “donotreply@example.com”