[Documentation] Form: document Rails form_with integration and real-world examples#434
Conversation
…orld examples (#134) Add a "Rails Integration" section to the Form docs covering: - Prose intro explaining the recommended strategy (form_with, explicit name/id, CSRF, FormFieldError for server errors) - Minimal single-field Rails form example with action, CSRF token, and FormFieldError - Devise-style login form example (email, password, remember me) with proper session[...] params and error handling
…egistry (#434) Convert the two Rails-integration examples ("Minimal Rails form" and "Devise-style login form") from VisualCodeExample to Heading + Codeblock so they are displayed as syntax-highlighted code without being live-rendered via instance_eval. This fixes the ComponentsControllerTest crash caused by helpers.users_path and helpers.user_session_path not existing in the docs app. Also rebuild mcp/data/registry.json to include the updated form docs.
CI fixes appliedFailure 1 — Docs test crash ( The two Rails-integration examples ("Minimal Rails form" and "Devise-style login form") in both Fix: Replaced both Failure 2 — MCP registry out of date Re-ran Verified locally:
|
- Bump RubyUI::VERSION to 1.4.0 and regenerate both lockfiles - Update home hero badge to "Native Dialog, Form docs, and more" (header version badge reads RubyUI::VERSION, updates automatically) - Rebuild MCP registry for 1.4.0 Highlights since v1.3.0: native <dialog> element (#435), accordion closed-content visibility fix (#433), Form Rails-integration docs (#434), multi-component generator and as:-render options.
Closes #134
How to reproduce the gap
Open https://rubyui.com/docs/form — the existing docs show visual examples (disabled, error states, checkbox, select, combobox) but give no guidance on:
action/ HTTP methodname/idto give each input so Rails params parse correctlymodel.errorstoFormFieldErrorWhat changed
Three new items added immediately before the component-setup tabs in both
gem/lib/ruby_ui/form/form_docs.rbanddocs/app/views/docs/form.rb:form_with(or setactionmanually), set explicitname/idon every input, include the CSRF hidden field, and pass server-side errors viaFormFieldError.action: helpers.users_path, CSRF token,FormFieldError, and a submit button; demonstrates the basic wiring.session[email]/session[password]/session[remember_me]params,autocompleteattributes,minlengthvalidation, and error display — the real-world pattern most Rails devs need.Testing instructions
/docs/formon a local or preview build and confirm the three new items appear below the Combobox examplesession[email]/session[password]parametersSummary by cubic
Adds a “Rails Integration” section to the Form docs with clear guidance on
form_with, CSRF, inputname/id, and mapping server errors toFormFieldError. Converts the Rails examples to code-only blocks so they don’t execute Rails helpers in the docs app.New Features
form_withfor action + CSRF, setting explicitname/id, and showing server errors withFormFieldError+model.errors.session[email],session[password],session[remember_me], withautocomplete,minlength, and error display.Bug Fixes
Heading+Codeblock(noinstance_eval) to avoid crashes from missinghelpers.*routes in the docs app; rebuiltmcp/data/registry.json.Written for commit 55fd108. Summary will update on new commits.