Skip to content

Conversation

@koppen
Copy link
Member

@koppen koppen commented Dec 8, 2025

No description provided.

Prefer `title_hint` over `_title_hint` for forms without an object
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for non-object based forms (created with form_tag) to Flowbite input components, expanding compatibility beyond the existing form_for and form_with implementations.

Key Changes

  • Added nil-safety checks for @object in error-related methods across input components
  • Modified id_for_hint_element to use compact_blank pattern for building IDs when form.object_name may be nil
  • Added comprehensive test suite (Flowbite::InputFieldWithoutObjectTest) covering input fields and selects without form objects

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
app/components/flowbite/input_field.rb Added nil check in errors method and refactored id_for_hint_element to handle nil object names using compact_blank
app/components/flowbite/input/label.rb Added nil check in errors? method to prevent NoMethodError on nil objects
app/components/flowbite/input/field.rb Added nil check in errors? method with documentation explaining the behavior
test/components/flowbite/input_field_test.rb Added complete test suite (153 lines) mirroring object-based tests but using forms without objects
CHANGELOG.md Documented the new feature under "Added" section in Unreleased

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@koppen koppen merged commit 124bca5 into main Dec 8, 2025
11 checks passed
@koppen koppen deleted the objectless_forms branch December 8, 2025 09:42
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.

2 participants