rails: Routing Error No route matches [POST] "/establishments/15"

Steps to reproduce

In Firefox,

# in routes.rb
resources :establishments

for this form code

= form_for establishment do |f|
  = render 'images', establishment: establishment, f: f
  .row
    .form-group.col-md-6
      = f.label :name, 'Name *'
      = f.text_field :name, class: 'form-control'
      = f.error_message_for(:name)
    .form-group.col-md-6
      = f.label :kind, 'Kind *'
      = f.text_field :kind, class: 'form-control'
      = f.error_message_for(:kind)
    .form-group.mx-auto.mb-0.mt-4
      - if establishment.persisted?
        = f.submit 'Update', class: 'btn btn-primary btn-md'
      - else
        = f.submit 'Add', class: 'btn btn-primary btn-md'

javascript:
    window.mustang.est_kinds = #{est_kinds.to_json.html_safe};



Problem Description

There is no problem in Safari and chrome, but there is in Firefox

There are two ways to go to establishments/:id/editpage which uses dashboard.slim layout:-

  1. from establishments/:id/; this uses application.slim layout
  2. from dashboards/ page; this uses dashboard.slim layout

its ok when I use method 2, but when i use method 1, i see this error

image

and in the form generated I see

<input type="hidden" name="_method" value="WkWDJMUJKj9koDpS9Lx1hrxqG6Jkg7My6zlWmUSbdEinRCsMkLKklEo0nmlekVk+TUpxKjErfUrryiRw09b79A==">

when it should be

<input type="hidden" name="_method" value="patch">

System configuration

Problem is in Firefox only

Rails version: 5.2.3

Ruby version: 2.6.3

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (7 by maintainers)

Most upvoted comments

I believe this issue is caused by a Firefox bug which has unfortunately been closed due to inactivity: https://bugzilla.mozilla.org/show_bug.cgi?id=520561.

Same problem here, with FF75. If I add autocomplete=off to the form, the problem goes away

Hi @shivabhusal thanks for the report. Can you make a new application that demonstrates this issue without using slim? If it is only reproducible with slim then you should open an issue with that gem. Thanks!