binarylogic/authlogic — pull request #420 by tiegz (2014-07-11 19:40:52+00:00)
Title: Update the way that callbacks are added to the model

### WHAT

Define the callbacks for models a little more sanely, using `ActiveModel::Callbacks#define_model_callbacks`.

### WHY

The way callbacks are implemented is a little outdated/confusing.

For instance, `Model.before_password_set` is currently a helper method that we generate.

When invoked, it calls `set_callback :before_password_set, :my_custom_callback`.

This actually sets `my_custom_callback` as a before filter to run before `before_password_set`. So we have callback chains on methods that are named like callbacks.

Instead, we could define `password_set` to have a callback chain (`after` and `before`), and use `define_model_callbacks` to generate those class helper methods for us (eg the methods that actually set the callbacks on `password_set`).

### NEXT

We should also refactor `Authlogic::Session::Callbacks`, but that one is a little tougher.