-
-
Notifications
You must be signed in to change notification settings - Fork 825
Add turbo_search_form_for helper for Turbo/Hotwire integration #1611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
scarroll32
merged 16 commits into
main
from
copilot/fix-51ddaba2-7853-472a-91a2-f36249325788
Sep 24, 2025
Merged
Changes from 3 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
91a934b
Initial plan
Copilot 17b2ef6
Add turbo_search_form_for helper for turbo stream support
Copilot a2d088e
Add documentation for turbo_search_form_for helper
Copilot b065c02
Merge branch 'main' into copilot/fix-51ddaba2-7853-472a-91a2-f3624932…
scarroll32 ffa6f5c
Changes before error encountered
Copilot 9d1fe43
Fix logic error in turbo_search_form_for turbo_frame handling
Copilot dc5cb80
Fix test interference by adding proper Ransack configuration cleanup
Copilot a249cfa
Refactor turbo_search_form_for into smaller, testable methods
Copilot c808efc
Merge branch 'main' into copilot/fix-51ddaba2-7853-472a-91a2-f3624932…
scarroll32 1f84ca1
Fix CI failure by removing unreliable caller_locations usage
Copilot 962bb8d
Merge branch 'main' into copilot/fix-51ddaba2-7853-472a-91a2-f3624932…
scarroll32 3e9848d
Fix data attribute format for Rails form helpers compatibility
Copilot 1ee6a7e
Merge branch 'main' into copilot/fix-51ddaba2-7853-472a-91a2-f3624932…
scarroll32 4c0a9a6
Merge branch 'main' into copilot/fix-51ddaba2-7853-472a-91a2-f3624932…
scarroll32 5169a10
Merge branch 'main' into copilot/fix-51ddaba2-7853-472a-91a2-f3624932…
scarroll32 37f67df
Fix specs
scarroll32 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot this method is long with a complex if/else. Can it be broken down into smaller methods and handle the conditional logic with returns if true / false ?
Each method can then be individually tested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored both
search_form_forandturbo_search_form_formethods into smaller, testable units. Extracted common logic into private methods:extract_search_and_set_url- handles search object validation and URL settingbuild_turbo_options- constructs turbo-specific data attributesbuild_html_options- builds base HTML options for formsfinalize_form_options- sets final form configurationEach method can now be individually tested and the complex conditional logic is simplified with early returns. Added comprehensive tests for all private methods. Fixed in commit a249cfa.