Clearance is now a Rails engine… BLAOW!
Clearance has served us well for many months. Our only complaints were shared by others:
With the re-institution of Rails engines in Rails 2.3, we decided to convert Clearance to engine. The process was relatively painless, the code is far cleaner, and we think we were able to scratch all our itches.
We highly recommend that you use the Cucumber features that come with Clearance to test the integration of the engine with your app:
script/generate clearance_features
You no longer run Clearance’s generated Shoulda & Factory Girl tests within your test suite. That code is unit tested internally. Use the Cucumber features to test integration. If and when you override functionality, write your own unit tests.
Read Mixing Cucumber with Test::Unit/Shoulda if you’re getting started with Cucumber and not using RSpec.
We haven’t and probably won’t ever move Clearance beyond email and password authentication, despite frequent requests. We’re focused on “clean code that works” for the baseline authentication we’ve written over and over again for clients.
A huge part of “clean code that works” means that overriding Clearance needs to be painless. The change to an engine helps achieve that goal.
class UsersController < Clearance::UsersController
def edit
...
end
end
ActionController::Routing::Routes.draw do |map|
map.resources :users
end
That’s it.
Users, Sessions, Passwords, and Confirmations).All knowledge pertaining to Clearance can be found on its Github wiki, where you’ll find such articles as:
.. and much more.
Enjoy!