mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-06-01 00:00:30 -04:00
Since #433, saving API resources nested under other API resources has not been the default. Instead, any instances where this should occur have been special cased with specific method implementations that would set the `#save_with_parent` flag when a field is written. This ended up causing some problems because as seen in #457, because places that we need to do this aren't well vetted, some were forgotten. This makes implementation of new fields that need this behavior simpler by implementing a `.save_nested_resource` metraprogramming method on the `APIResource` class. This can be called as necessary by any concrete API resource implementations. We replace existing implementatinos and also add one to `Subscription`, which had previously been suffering from a similar problem where its `#source` had not received a special case.