I have a large Rails app that has 34 different types of Users through Single Table Inheritance. When the app was initially designed, it was assumed that the User would have different behaviors based on type. This assumption was wrong, so I'm looking to refactor.
The question is how would you refactor out the User STI?
- Add a ton of boolean attributes to User (ie.
User#is_employee?
,User.is_contractor?
) - Rename
User#type
toUser#user_type
and just do string matching based on the field - Some horrible lookup table solution
- Something I'm missing...
Just to clarify, a User needs a 'type' for ACL reasons, but with STI they're really just empty models and STI causes issues with specing, general pain in the ass, etc.