ralphos/ix — pull request #1 by ralphos (2014-03-30 02:50:18+00:00)
Title: Rw/seller creates account

### What's this PR do?

This PR is for the User account creation feature for IX (Invoice Exchange). We're using Clearance to handle authentication and since IX is a two-sided marketplace, the code has been designed to sign up as a User and then create a polymorphic association so there are two types of Users - a Seller & a Buyer.

The specs have been largely generated from Clearance, and the sign up process has been slightly modified to deal with signing up as a Seller or Buyer.

The idea is for the User model to use `delegate` to get methods defined on Seller or Buyer. That way we can call them on `current_user`, rather than defining a `current_seller` or `current_buyer` although that approach could be useful.

### Where should the reviewer start?

*The reviewer should perhaps start at `spec/features/visitor_signs_up_spec.rb`.
*Then view `models/user.rb`, `models/seller.rb`, `models/buyer.rb`.
*Also, please check `factories.rb` has been set up correctly to handle polymorphic associations.

### Any background context?

Most of the context has been described in the first section above. The app is for a two-sided marketplace where Buyers and Seller will be required to login. Each will see different sections of the site once they are logged in.

I suppose the main question is whether this approach of using polymorphic associations is required. Since `Buyer` and `Seller` are likely to have significantly different attributes, which is why I preferred this approach over STI. I'm not sure if delegating methods to `current_user` is the way forward though.