Replies: 2 comments
-
There's definitely something that could be good here, although I don't think adding it to the Pay::Charge makes sense since it limits to a single association. ActiveStorage is a good example of how it should ideally work for maximum use cases:
You could apply this approach to both |
Beta Was this translation helpful? Give feedback.
-
Right that's a good idea to allow multiple associations. I'll start that way and see what I can come up with. 👍 |
Beta Was this translation helpful? Give feedback.
-
In my application I have two models that can be related to one-off charges, Invoice and FormResponse. Currently, I associate these other records by adding has_one relationships to Pay::Charge with an extension:
with an accompanying belongs_to on the Invoice and FormResponse models.
This works, but what would you think about adding a polymorphic "Chargable" association on Pay::Charge? This would allow a built-in way to associate a Pay::Charge record to any other record in an application.
I'd imagine usage being something like:
If this seems like a good idea, I'd be happy to start PR.
Beta Was this translation helpful? Give feedback.
All reactions