spree/spree — pull request #1722 by yeeguy (2012-06-28 07:45:03+00:00)
Title: Patch core initializer and user model to enable custom users with orders

There's probably a much better way to do this, but this patch works and passes core tests.

If merged, this PR would require a slight tweak to the custom authentication instructions on http://ryanbigg.com/spree-guides/authentication.html

I.e., instead of directly setting Spree.user_class = "User" (or whatever the developer wants their custom user model to be), this PR would require a developer to set an environment var SPREE_USER_CLASS (in the same initializers/spree.rb file).

Net effect is that Spree::User becomes a sub-class of User (or whatever custom user model a developer specifies in initializers/spree.rb). All the associations between Spree::Order and Spree::User are not touched at all -- because Spree::User is a subclass of User, the desired associations between Spree:Order and custom User are automatically applied by ActiveRecord.