-
Notifications
You must be signed in to change notification settings - Fork 403
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
Wrong HTTP method after updating from 19.1.1 to 20.0.0 #867
Comments
Hi, Thanks for this report, I can confirm. I've identified the issue and I do not recommend to use CSV with Rails 7. There is something wrong and I do not have a clear clue on both how to fix this behavior and why the tests didn't find the bug. The problem is here: client_side_validations/lib/client_side_validations/action_view/form_builder.rb Lines 32 to 33 in 8207046
On localhost, I cannot even add
without a backtrace As a workaround, if CSV works for your use case, = simple_form_for @model, url: my_action_path, remote: true, validate: true, html: { method: :patch } do |f| PR (and a failing spec) are very welcomed |
This change is not needed in Rails 7 but on older versions Fix: #867 Ref: rails/rails#43421
20.0.1 released, thanks |
Awesome. I'm actually using rails 6.1.4.4. I'll test with the new gem version. Thanks! |
I can confirm 20.0.1 fixes the issue with rails 6.1.4.4. Thank you! |
I've splitted the other issue I've found while investigating this into #869 I've also understood why the tests pass. The other issue is related to Rails 7, so it should not be a problem on 6.1 |
Steps to reproduce
We have a rails app using
client_side_validations
and we had problems updating it from to19.1.1
to20.0.0
.A few forms using
client_side_validations
are issuing the request with the wrong HTTP method, resulting in a 404.For example, action defined as
PATCH
, butPOST
is used.Our forms are defined with
simple_form_for
and we are specifying the correct http method viamethod:
argument.I noticed that, on 20.0.0,
<input type="hidden" name="_method" value="patch">
is missing from the HTML, so rails doesn't know it is aPATCH
method.Could this be related to #862 mentioned in the CHANGELOG? Is that something I should adjust on my code?
Expected behavior
Requests coming from JS should use the correct HTTP method.
Actual behavior
Requests coming from JS are using a wrong HTTP method.
System configuration
Rails version: 6.1.4.4
Ruby version: 2.7.4
Client Side Validations version: 20.0.0
Code snippet from your model of the validations
Not relevant; it happens regardless of which validations are being used
The whole form code from your template
The resulting HTML
Regular
form
element, but<input type="hidden" name="_method" value="patch">
is missing.Browser's development console output
Additional JavaScript Libraries
n/a
Repository demostrating the issue
n/a
The text was updated successfully, but these errors were encountered: