-
Notifications
You must be signed in to change notification settings - Fork 0
Upgrading to Rails engine
In your User model, change:
include Clearance::Model
to:
include Clearance::User
In your ApplicationController, change:
include Clearance::App::Controllers::ApplicationController
to:
include Clearance::Authentication
If you haven’t edited PasswordsController or ConfirmationsController, delete them and the app/views/passwords and app/views/confirmations directories.
If you’ve added edit, update, show, index, or destroy actions to the controller, change:
class UsersController < ApplicationController
include Clearance::UsersController
end
To:
class UsersController < Clearance::UsersController
end
Otherwise, delete it. Same for SessionsController, although it is more likely that you can completely delete the SessionsController and app/views/sessions directory in your app.
You can delete app/models/clearance_mailer.rb and app/views/clearance_mailer.
Check the config/clearance_routes.rb
file in Clearance. Remove any routes in your app that are included by Clearance. That may include:
ActionController::Routing::Routes.draw do |map|
map.resources :users, :has_one => [:password, :confirmation]
map.resource :session
map.resources :passwords
end
If you have a shortcut route like this:
map.with_options :controller => 'sessions' do |m|
m.sign_in '/sign_in', :action => 'new'
m.sign_out '/sign_out', :action => 'destroy'
end
Change it to:
map.with_options :controller => 'clearance/sessions' do |m|
m.sign_in '/sign_in', :action => 'new'
m.sign_out '/sign_out', :action => 'destroy'
end
If you’ve extended any of these actions in your app (such as adding a users#edit
action), you’ll need to override the routes from within your app. So, in that example, you’d need map.resources :users
in your app’s routes file.
In test/test_helper.rb, delete:
include Clearance::TestHelper
In test/unit/user_test.rb, delete:
include Clearance::UserTest
In test/functional/sessions_controller_test.rb, delete:
include Clearance::SessionsControllerTest
In test/functional/users_controller_test.rb, delete:
include Clearance::UsersControllerTest
You’ll also want to find and replace instances of:
- logged_in? with signed_in?
- login_as with sign_in_as
- crypted_password with encrypted_password
- remember_token with token
- remember_token_expires_at with token_expires_at
We suggest using ack
to search through files.
curl http://ack.googlecode.com/svn/tags/latest/ack > ~/bin/ack && chmod 0755 !$