RailsApps / rails-stripe-membership-saas

An example Rails 4.2 app with Stripe and the Payola gem for a membership or subscription site.
http://railsapps.github.io/rails-stripe-membership-saas
1.14k stars 231 forks source link

Could roles and plans be consolidated? #146

Closed nikolay12 closed 9 years ago

nikolay12 commented 9 years ago

I noticed that the plans need to be hard-coded as ENUMs in the User model. Why can't they be dynamically loaded from the Plan table? There needs to be a foreign key reference which can be used to validate the User.

DanielKehoe commented 9 years ago

Keep in mind that the application is designed to accommodate plans and permissions that don't have a one-to-one correspondence. For example, there can be a role for an administrator who doesn't have a plan at all. The ENUMs in the User model are roles to use for access control. In the example application, they happen to correspond to plans (plus a role for admin).

I'm happy to hear if there is a better approach given these requirements.

nikolay12 commented 9 years ago

OK - I see your point. Still the other issue I raised (the unDRY View) is there.