ralphos/ix — pull request #2 by ralphos (2014-04-06 03:43:01+00:00)
Title: Rw/seller completes registration

### What's this PR do?

This PR is for a Registration wizard ('wizard') which a user (seller specifically) will see when they first login to the site. The wizard currently consists of two steps/forms both of which may or may not need to edit multiple objects. More steps may be added to the wizard in the future.

### Where should the reviewer start?

1. Buyer & Seller polymorphic associations were removed and instead a column 'account_type' on User was added. I think the earlier solution was over-complicated and didn't add much.
2. We track the registration 'state' (or step as referred to in the code) using Rails 4.1 enums (see `user.rb`)
3. When a User first signs up, we send them to the `registrations_controller` and show them the relevant Registration step based on their registration step.
4. The RegistrationsController create action is smart enough to know which form object to use to by using the `RegistrationForm` service class which checks the User's state and returns the appropriate form object class.
5. When a User has completed both registration steps, they are redirected to the auctions index page.
6. Route Constraints have been added to make sure you can only view the registration and auction pages if a User is signed in.

### Any background context?

The requirements as per the Registration wizard appear as though they could change quite quickly. Therefore I wanted to build a wizard which was easy to change or add to. Originally I set out to create a resource for each registration step but that felt clumsy, and having a controller for each step didn't feel right.

I'm quite happy with individual form objects handling each form submission, mainly because we don't have to add any conditional validations depending on the registration step.

I'm less happy about checking which params are required in the RegistrationsController, as this will eventually build up if we add more steps. I'm considering creating a `RegistrationParams` object which will be responsible for checking which params are permitted depending on the registration step that just got submitted.

Please take a look @georgebrock when you get a chance :smile: