If you have a number of different plans, it can be hard to grab the subscription for a customer.
You can't just do @user.payment_processor.subscription to grab that user's subscription, as it checks by the name.
In the billing code I currently use in one of my apps, which I'm hoping to migrate to Pay, I have a default boolean and then in the account model it's just a has_one association.
has_one :subscription, -> { where(default: true) }, class_name: "Billing::Subscription"
Thoughts?
If you have a number of different plans, it can be hard to grab the subscription for a customer.
You can't just do
@user.payment_processor.subscriptionto grab that user's subscription, as it checks by the name.In the billing code I currently use in one of my apps, which I'm hoping to migrate to Pay, I have a
defaultboolean and then in the account model it's just a has_one association.Thoughts?