-
Notifications
You must be signed in to change notification settings - Fork 1
Upgrading to Rails engine
In your User model, change:
include Clearance::Modelto:
include Clearance::UserIn your ApplicationController, change:
include Clearance::App::Controllers::ApplicationControllerto:
include Clearance::AuthenticationIf 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
endTo:
class UsersController < Clearance::UsersController
endOtherwise, 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
endIf 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'
endChange it to:
map.with_options :controller => 'clearance/sessions' do |m|
m.sign_in '/sign_in', :action => 'new'
m.sign_out '/sign_out', :action => 'destroy'
endIf 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::TestHelperIn test/unit/user_test.rb, delete:
include Clearance::UserTestIn test/functional/sessions_controller_test.rb, delete:
include Clearance::SessionsControllerTestIn test/functional/users_controller_test.rb, delete:
include Clearance::UsersControllerTestYou’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 !$