Skip to content

Add recipe steps with dynamic form UI#30

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1778526446-recipe-steps
Open

Add recipe steps with dynamic form UI#30
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1778526446-recipe-steps

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

Summary

Implements Issue #28 — "As Michael, I want my Recipes to have Steps."

Changes:

  • Step model with recipe_id, position (integer, NOT NULL), and body (text, NOT NULL)
  • Recipe model updated with has_many :steps (ordered by position, dependent destroy)
  • Stimulus steps_controller.js for dynamic add/remove step rows — mirrors the existing ingredients pattern. Step labels auto-renumber (Step 1, Step 2, ...) when rows are added or removed
  • Recipe form has a "Steps" section below ingredients with + Add Step button, text area per step, and × remove button
  • Recipe show page displays steps as a numbered list below ingredients
  • Controller handles step saving with position auto-assigned from form order. Blank steps and destroyed rows are skipped
  • Tests: 100 tests, 306 assertions — model validations, CRUD with steps, destroy cascade, position ordering

Review & Testing Checklist for Human

  • Create a new recipe with 2-3 steps — verify steps save and display correctly on show page
  • Edit the recipe — verify existing steps load in the form, add/remove steps, save and confirm changes
  • Verify step numbers renumber dynamically when removing a step from the middle
  • Delete a recipe with steps — confirm steps are also deleted (no orphans)
  • Create a recipe with only ingredients (no steps) — verify the steps section doesn't appear on show page

Notes

  • Position is auto-assigned from the visual order of steps in the form — users never set it manually
  • Steps are destroyed and re-created on each save (same pattern as ingredients) to keep position assignment simple
  • This PR does NOT add step parsing from URLs — that's Issue #29

Link to Devin session: https://app.devin.ai/sessions/06cbafdef49a46e88741224f05c8f84e
Requested by: @utricularian

- Create Step model with recipe_id, position, body fields
- Add Stimulus steps_controller.js for dynamic add/remove rows
- Steps section rendered below ingredients on recipe form
- Step numbers auto-renumber when adding/removing rows
- Position auto-assigned from visual order on save
- Steps displayed as numbered list on recipe show page
- Steps ordered by position and destroyed with recipe
- 100 tests, 306 assertions, all passing

Closes #28

Co-Authored-By: Sam Serrano <samuel.j.serrano@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant