Rails:Heroku 不理解 :patch/:put 请求?

Rails: Heroku doesn't understand :patch/:put requests?

我制作了一个按钮,可以在本地更新我的 Lead 对象:

<%= link_to status.to_s.titlecase, lead_path(@lead, lead: { status: status }), method: :patch, class: 'dropdown-item' %>

但是远程(在 Heroku 上)没有任何反应。日志中没有任何有用的内容:

2016-11-15T17:23:45.013893+00:00 heroku[router]: at=info method=GET path="/leads/2562?lead%5Bstatus%5D=contact_established" host=app.herokuapp.com request_id=57e8b4e9-7a61-4b86-85eb-8f68f1fedd43 fwd="IP" dyno=web.1 connect=1ms service=44ms status=200 bytes=9678
2016-11-15T17:23:44.972753+00:00 app[web.1]: [57e8b4e9-7a61-4b86-85eb-8f68f1fedd43] Started GET "/leads/2562?lead%5Bstatus%5D=contact_established" for IP at 2016-11-15 17:23:44 +0000
2016-11-15T17:23:44.974230+00:00 app[web.1]: [57e8b4e9-7a61-4b86-85eb-8f68f1fedd43] Processing by LeadsController#show as HTML
2016-11-15T17:23:44.974316+00:00 app[web.1]: [57e8b4e9-7a61-4b86-85eb-8f68f1fedd43]   Parameters: {"lead"=>{"status"=>"contact_established"}, "id"=>"2562"}
2016-11-15T17:23:44.988214+00:00 app[web.1]: [57e8b4e9-7a61-4b86-85eb-8f68f1fedd43]   [1m[36mUser Load (11.5ms)[0m  [1m[34mSELECT  "users".* FROM "users" WHERE "users"."id" =  ORDER BY "users"."id" ASC LIMIT [0m  [["id", 1], ["LIMIT", 1]]
2016-11-15T17:23:44.990722+00:00 app[web.1]: [57e8b4e9-7a61-4b86-85eb-8f68f1fedd43]   [1m[36mLead Load (1.0ms)[0m  [1m[34mSELECT  "leads".* FROM "leads" WHERE "leads"."id" =  LIMIT [0m  [["id", 2562], ["LIMIT", 1]]
2016-11-15T17:23:44.992582+00:00 app[web.1]: [57e8b4e9-7a61-4b86-85eb-8f68f1fedd43]   Rendering leads/show.html.erb within layouts/application
2016-11-15T17:23:45.007497+00:00 app[web.1]: [57e8b4e9-7a61-4b86-85eb-8f68f1fedd43]   Rendered leads/show.html.erb within layouts/application (14.7ms)
2016-11-15T17:23:45.009303+00:00 app[web.1]: [57e8b4e9-7a61-4b86-85eb-8f68f1fedd43] Completed 200 OK in 35ms (Views: 17.2ms | ActiveRecord: 12.6ms)

flash 中没有返回错误消息,没有。我在:patch:put之间改变了方法,仍然没有。

我错过了什么?为什么 link_to 会在本地更新记录而不在 Heroku 上执行任何操作?

更新

为 Heroku 尝试自定义路由:

resources :leads do
  member do
    patch 'update', to: 'leads#update', as: :update
  end
end

并更改了我的 link 以使用新路径:

<%= link_to status.to_s.titlecase, update_lead_path(@lead, lead: { status: status }), method: :patch, class: 'dropdown-item' %>

在本地工作,我在 Heroku 上收到页面未找到错误。

怎么回事?

所以出于纯粹的烦恼,我提出了一个 :get Heroku 可以理解的请求。这是路线,即:

resources :leads do
  member do
    get 'change', to: 'leads#change', as: :change
  end
end

控制器(注意非标准参数)

def change
  if @lead.update_attributes(change_lead_params)
    notice = "#{helpers.full_name(@lead)} changed."
    redirect_to lead_path(@lead), notice: notice
  else
    flash.now[:error] = "#{@lead.errors.full_messages.to_sentence}."
    render :show
  end
end

private

def change_lead_params
  params.permit(:status, :loan_product)
end

link_to:

<%= link_to status.to_s.titlecase, change_lead_path(@lead, status: status), class: 'dropdown-item' %>

如能提供有关此问题的任何信息,我们将不胜感激,因为 Heroku 没有理由拒绝 :put 请求,对吗?