Skip to content

Wrong HTTP method after updating from 19.1.1 to 20.0.0 #867

@lucasfais

Description

@lucasfais

Steps to reproduce

We have a rails app using client_side_validations and we had problems updating it from to 19.1.1 to 20.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, but POST is used.

Our forms are defined with simple_form_for and we are specifying the correct http method via method: 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 a PATCH 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

= simple_form_for @model, url: my_action_path, remote: true, validate: true, method: :patch do |f|

The resulting HTML

Regular form element, but <input type="hidden" name="_method" value="patch"> is missing.

Browser's development console output

  • I confirm that my browser's development console output does not contain errors, expect the 404 error mentioned

Additional JavaScript Libraries

n/a

Repository demostrating the issue

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions