Closed narinda closed 2 years ago
I checked this out locally to play and it looks like the embedded form renderer specs might need to be updated to satisfy this change @narinda.
I checked this out locally to play and it looks like the embedded form renderer specs might need to be updated to satisfy this change @narinda.
Thanks @andrewcroome, I've updated the specs.
Sweet. Ah, yep, this is breaking change I guess as anything calling that method with a hash will need to put the hash in
{}
for things to continue to work.
@andrewcroome Hmm yeah, I wonder if in that case a better implementation might be a #with
method that returns a copy of the object with additional options:
component_form_renderer.with(context: self).call(data)
@narinda yeah, that might be a good way forward.
@narinda yeah, that might be a good way forward.
@andrewcroome I've done that now, and it's been tested in a branch in our app. LMK if it looks ok to you.
Allow additional options to be passed to the
EmbeddedFormRenderer
after the object has been initialized.A
#with
method has been added toEmbeddedFormRenderer
that allows additional options to be configured. The method creates a copy of the class with the new options merged in.For example In our hanami app we have a context helper that renders components. This allows us to access context methods like
current_url
from our component templates by configuring it with the current context:component_form_renderer.with(context: self).(component_data)