Is there a simpler way to generate a
# avo-2
b
Is there a simpler way to generate a variable number of fields without using nested records recipe approach? Specifically, I want a resource create page to consist of a variable number of text fields.
l
what is a "variable number of text fields"? can you share an example please?
b
a user needs to create a report. So I have a resource "Report" The user could create a new Report via an action on another resource and then based on the number of models selected in the action, the user is directed to create the Report with a text field corresponding to each selected Model. Reports will vary in the number of text fields they have based on the number of models selected in the preceeding action.
My intent is for the data in the report would be stored in a jsonb field so we can have a variable number based on the number of models selected via the action...
l
you can have a "number of things" field in an action and then redirect to a new view with a special param
?number_of_things=3
. on that resource you can have a resource tool that is only displayed if that param is there.
on that resource tool you can use that recipe to generate the fields
it's still some non-DSL work to be done
but you can use the DSL in resource tools
something like that
<%= avo_edit_field(:features, as: :key_value, form: form) %>
b
👍 cool this is close to what I was thinking but adds some extra context / info I wasn't familiar with. perfect thank you!
unfortunatley those URLs don't work apparently but I can investigate in the meantime
l
ok. just a sec
there!