trailblazer / reform

Form objects decoupled from models.
https://trailblazer.to/2.1/docs/reform.html
MIT License
2.49k stars 184 forks source link

Support for polymorphic associations #336

Open dlupu opened 8 years ago

dlupu commented 8 years ago

Hello Nick,

We've had a discussion 2 weeks ago in Gitter about the best way to manage models with polymorphic associations.

Up until now, with a simple, non-polymorphic has_many association It's possible to use the :form option to specify a static parameter indicating the child form to be used.

With polymorphic associations we need more flexibility. You seemed pretty confident that this wouldn't be too complicated to support them. I'm not sure if this has been done, so I'm creating this ticket to keep track of any changes related to this.

Thank you BR Dorian

franzejr commented 8 years ago

Nice, @dlupu. I'm having the same issues as well. It was awesome if we have this feature! :+1:

dlupu commented 8 years ago

@apotonick @nicefiction any news on this ?

nicefiction commented 8 years ago

@dlupu I am inching towards it. I am planning to tackle the polymorphic challenge with builders.

apotonick commented 8 years ago

This has to be implemented in the Disposable gem, not in Reform, but I now remember there was a reason why we didn't allow it...

dlupu commented 8 years ago

That's a mysterious answer :) . Should we understand that support for polymorphic associations will not be available anytime soon (or never? ) in Reform ?

apotonick commented 8 years ago

I like being mysterious.. :stuck_out_tongue_winking_eye:

It will surely be available at some point. Can't say when, though.

fran-worley commented 8 years ago

Looks like this is linked to #132. Thanks for the heads up @flexoid

SirRawlins commented 4 years ago

Found myself needing polymorphic support a few times, and as suggested in #132 I like the idea of being able to pass a lambda/proc to the form: option on properties.

Seems that for the moment Reform passes form: down to disposable as twin: - Disposable then just calls new() on whatever it's handed.

Evaluating a proc/lambda to get a class back before instantiating it seems like a simple enough change. But do we think that change would belong in Reform? or Disposable?

@apotonick - Have you given this much thought Nick? Do you see any obstacles that might cause problems?

emaglio commented 4 years ago

We are not adding any new feature in reform 2.3.0 but we might consider this for reform 3.x - again it’s hard to tell when though - I will add this in the 3.x project and hopefully we can implement it soonish

SirRawlins commented 4 years ago

Totally understand. 👍 Thanks for all the work you folks put in.

On Tue, 5 Nov 2019, 21:33 Emanuele Magliozzi, notifications@github.com wrote:

We are not adding any new feature in reform 2.3.0 but we might consider this for reform 3.x - again it’s hard to tell when though - I will add this in the 3.x project and hopefully we can implement it soonish

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/trailblazer/reform/issues/336?email_source=notifications&email_token=AAFWEK4UNPWGZKAUXQ6RXL3QSHRDXA5CNFSM4B2W5QG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDEM4SY#issuecomment-550030923, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFWEK7BCGXQJZ73XANY6ETQSHRDXANCNFSM4B2W5QGQ .