Rails:为什么这种形式触发错误的动作?

问题描述

| 我的应用程序中有一个表单,该表单触发了错误的控制器操作。这是渲染的表单:
<form id=\"edit_profile_1\" class=\"simple_form profile windowed\" method=\"post\" enctype=\"multipart/form-data\" action=\"/profiles/1\" accept-charset=\"UTF-8\">
  <div style=\"margin:0;padding:0;display:inline\">
  <input type=\"hidden\" value=\"✓\" name=\"utf8\">
  <input type=\"hidden\" value=\"put\" name=\"_method\">
  <input type=\"hidden\" value=\"...\" name=\"authenticity_token\">
  </div>
....
</form>
因此,几乎是一种正常形式。在我的本地环境中,此操作正常,它会触发“ 1”操作。但是,由于某种原因在Heroku上部署时,这会触发
profiles#show
动作,因此无法正常工作。 是什么赋予了?以前有没有人遇到此错误,您知道如何解决吗? -编辑-@Laas:这是生产日志:
2011-05-20T21:41:38+00:00 app[web.1]: Started GET \"/account\" for 98.201.59.6 at 2011-05-20 14:41:38 -0700
2011-05-20T21:41:40+00:00 heroku[router]: GET www.fourthenvironment.org/account dyno=web.1 queue=0 wait=0ms service=2212ms bytes=8672
2011-05-20T21:41:40+00:00 app[web.1]: Connected to NewRelic Service at collector-6.newrelic.com:80
2011-05-20T21:41:40+00:00 heroku[router]: GET www.fourthenvironment.org/javascripts/rails.js dyno=web.1 queue=0 wait=0ms service=2ms bytes=5176
2011-05-20T21:41:41+00:00 heroku[router]: GET www.fourthenvironment.org/javascripts/jquery.144.min.js dyno=web.1 queue=0 wait=0ms service=3ms bytes=78865
2011-05-20T21:41:42+00:00 heroku[router]: GET www.fourthenvironment.org/stylesheets/style.css dyno=web.1 queue=0 wait=0ms service=3ms bytes=63444
2011-05-20T21:41:47+00:00 heroku[router]: GET www.fourthenvironment.org/favicon.ico dyno=web.1 queue=0 wait=0ms service=4ms bytes=1672
2011-05-20T21:41:50+00:00 app[web.1]: 
2011-05-20T21:41:50+00:00 app[web.1]: 
2011-05-20T21:41:50+00:00 app[web.1]: Started POST \"/profiles/1\" for 98.201.59.6 at 2011-05-20 14:41:50 -0700
2011-05-20T21:41:50+00:00 heroku[router]: POST www.fourthenvironment.org/profiles/1 dyno=web.1 queue=0 wait=0ms service=102ms bytes=420
2011-05-20T21:41:50+00:00 app[web.1]: THIS SHOULD NOT BE TRIGGERED
2011-05-20T21:41:50+00:00 heroku[router]: GET www.fourthenvironment.org/profiles/1 dyno=web.1 queue=0 wait=0ms service=30ms bytes=414
2011-05-20T21:41:50+00:00 app[web.1]: 
2011-05-20T21:41:50+00:00 app[web.1]: 
2011-05-20T21:41:50+00:00 app[web.1]: Started GET \"/account\" for 98.201.59.6 at 2011-05-20 14:41:50 -0700
请注意\“不应触发\”。这是控制器:
class ProfilesController < ApplicationController
    before_filter :authenticate_user!

    def show
        puts \"THIS SHOULD NOT BE TRIGGERED\"
        redirect_to account_path
    end


    def edit
        @profile = Profile.find(params[:id])
    end

    def update
        puts \"profiles#update\"
        @profile = Profile.find(params[:id])
        if @profile.update_attributes(params[:profile])
            redirect_to account_path,:notice => t(\'user.notice.updated\')
        else
            render :action => \'edit\'
        end
    end

end
    

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)