Open arvinaik opened 3 years ago
Something that you could try is to create a custom field, perhaps derived from the existing polymorphic one, which would then behave the way you specifically want.
As for the helper attributes, I'm not sure I understand. If you mean "virtual attributes", then you can have a field based off a method in your model. The example app does this with Customer#lifetime_value
:
However this will be read-only initially. Being able to write to it will require that you customize your controller to handle this param when the form is submitted.
I have a model Review which has a Field::Polymorphic Reviewable.
When I try to access the form page through new/edit, it takes very long to load due to the form loading every instance of a reviewable object.
Is there anyway to prevent the loading of all instance of the polymorphic class?
Alternatively is there a way I can have 'helper attributes' that do not exist in the model, but are used to determine the id of the polymorphic field?