Skip to content
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

Add ability to specify non-existent field for combobox #28

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
Use try instead of respond_to?
  • Loading branch information
Pranav Babu committed Feb 11, 2024
commit 845964d67264dade45ec647101065e1a4b226d8c
6 changes: 1 addition & 5 deletions app/presenters/hotwire_combobox/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,7 @@ def hidden_field_data
end

def hidden_field_value
if form&.object&.respond_to?(name)
form.object.public_send(name)
else
value
end
form&.object&.try(name) || value
end


Expand Down