ndlib/curate — pull request #130 by jeremyf (2013-09-23 17:23:11+00:00)
Title: Extracting user creation callbacks

Achtung!

Our User#create and User#update actions were getting complicated; This
complication impacted our tests, rapidly increasing run times. It also
incorporated several callbacks, which can quickly spiral into
something very labrynthine.

However, due to some of the constraints and design decisions of the
Devise and ActiveRecord, using the Account composite object in
Devise's registration controller creates complicating code.

I have worked hard to isolate this complicated negotiation of Devise,
ActiveRecord, and ActiveFedora inside the Account class.

So, this commit is here to balance three things:

* Callbacks being implicitly called for behavior vs.
Explicitly declared behavior (i.e. an Account represents a User,
Person, and Profile).
* Improving test speeds via "better" production code factoring vs.
improving speeds via test trickery.
* Creating understandable and maintainable code; This one is likely
the most contentious as the Account composite object is non-trivial
and dependendent on the Devise implementation.

Incidentally, this is highlighting how we might be able to model an
object that is persisted in Fedora and ActiveRecord.

Closes ndlib/planning#180