1

I am using Omniauth with multiple identities to login (i.e., Facbook, LinkedIn etc.). Right now, I have a single model called Service, with provider (with values facebook, linkedin etc.), oauth_token and some other fields.

Now, I added many methods to Service model, which only applied to a particular provider. For example, friend_count, which only applies if provider is facebook.

I think my code starts to smell and needs refactoring. I don't think I will add a lot of columns that are provider-specific, so polymorphism would not be necessary.

My question is: which design pattern I should take: single-table inheritance, or something simpler?

4

0 回答 0