Closed emilioeduardob closed 1 year ago
Hello Emilio,
Thanks for the contribution. QQ: Why isn't useful for products
? I see the API doc includes endpoints for adding or deleting a product from a deal.
oh, you are right, I guess I was confusing the existing add_product
method that receives a Product
instance
Yes, it should work ok with products, in this case, deal
will support add_product
with Product
resource instance and new_product
with a regular hash with params
With your solution, I suggest naming the methods add_*
instead of new_*
deprecating the current add_product
, and documenting the breaking change - for the particular case of Deal - in the changelog.
Hey @j4rs , I've updated the PR with your suggestions. Let me know if you need me to make any other adjustment
This PRs modifies the
has_many
method to addnew_{relation}
anddelete_{relation}
For example:
But this will also generate the same methods for other
has_many
associations, like for Followers, but it's not useful forhas_many :products
for instanceIf you guys prefer, I can just add these methods to handle participants as methods directly on the
Deal
resourcePS: I'll add specs after the first review of the PR