0

I'm developing a food recipe app where a user can post their cooking recipe.
I'm stuck on the part where the user describes the steps for preparation. I want to add a text field for each step. Is there any way to do so?
I am using Rails 7.0.5

I want to have more 'step' fields dynamically.

<%= bootstrap_form_with(model: @recipe, local: true) do |f| %>
    <%= f.text_field :recipe_name %>
    <%= f.email_field :email %>
    <%= f.text_field :step %>
<% end %>

Any methods using javascript or some other gem would be acceptable.

2
  • The cocoon gem has always been my go to for this. While it is a bit older at this point there are tutorials still implementing this in rails 7. Commented Jun 28, 2023 at 18:27
  • Does this answer your question? Dynamically add fields in rails with out nested attributes Commented Jun 28, 2023 at 20:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.