Skip to content

Upgrading to Rails engine

croaky edited this page Sep 13, 2010 · 13 revisions

User model

In your User model, change:

include Clearance::Model

to:

include Clearance::User

ApplicationController

In your ApplicationController, change:

include Clearance::App::Controllers::ApplicationController

to:

include Clearance::Authentication

Controllers

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.

Mailer

You can delete app/models/clearance_mailer.rb and app/views/clearance_mailer.

Routes

Check the config/routes.rb file in Clearance. Remove any routes in your app that are included by Clearance.

Tests

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

If you’ve got a really old version of Clearance…

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 !$