【问题标题】:Issue with Form Not Posting Using Nginx, Ruby, HAML and Sinatra使用 Nginx、Ruby、HAML 和 Sinatra 无法发布表单的问题
【发布时间】:2011-09-03 08:08:10
【问题描述】:

这是我的 ask.haml 文件中的代码:

 %form{:action => "/calendar", :method => "post"}
            .inputRow
              %label How many days in a row do you work?
              %input#on{:name => "on", :tabindex => "1", :title => "Number of days in a row you work", :type => "text", :value => "4", :id=> "on"}/
            .inputRow
              %label How many days in a row are you off?
              %input#off{:name => "off", :tabindex => "2", :title => "Number of days in a row you're off", :type => "text", :value => "3", :id=> "off"}/
            .inputRow
              %label When is the start of your next block off?
              %input#date{:name => "date", :tabindex => "3", :title => "Start of your next block off", :type => "text", :value => "8/31/2011", :id=> "date"}/
            %button#button{:type => "submit"}

而且,当我在本地机器上使用 shotgun 或普通 ruby​​ 运行它并运行主 .rb 文件时,它会像这样:

<form action='/calendar' method='post'> 
          <div class='inputRow'> 
            <label>How many days in a row do you work?</label> 
            <input id='on_on' name='on' tabindex='1' title='Number of days in a row you work' type='text' value='4' /> 
          </div> 
          <div class='inputRow'> 
            <label>How many days in a row are you off?</label> 
            <input id='off_off' name='off' tabindex='2' title="Number of days in a row you're off" type='text' value='3' /> 
          </div> 
          <div class='inputRow'> 
            <label>When is the start of your next block off?</label> 
            <input id='date_date' name='date' tabindex='3' title='Start of your next block off' type='text' value='8/31/2011' /> 
          </div> 
          <button id='button' type='submit'></button> 
        </form> 

但是,当我将它上传到我的服务器(webfaction)并重新启动 nginx 时,我得到了这个:

<form> 
        <div class="inputRow"><label>How many days in a row do you work?</label><input type="text" name="on" value="" id="on"  tabindex="1" placeholder="4" title="Number of days in a row you work" /></div> 
        <div class="inputRow"><label>How many days in a row are you off?</label><input type="text" name="off" value="" id="off"  tabindex="2" placeholder="3" title="Number of days in a row you're off" /></div> 
        <div class="inputRow"><label>When's the start of your next block off?</label><input type="text" name="on" value="" id="on"  tabindex="3" placeholder="8/31/2011" title="Start of your next block off" /></div> 
        <button type="submit" id="button"></button> 
        </form> 

缺少帖子以及将其定向到的页面。关于如何开始解决这个问题的任何想法?提前致谢。

更新:当我对此进行了深入研究时,看起来 nginx 正在加载一个名为 ask.haml 的旧文件。我已确认较新的文件在服务器上。

【问题讨论】:

    标签: ruby post nginx sinatra haml


    【解决方案1】:

    听起来您可能在浏览器中缓存了 html。尝试打开其他浏览器(或明确清空浏览器缓存)并将其对准您的生产应用。

    【讨论】:

    • 问题是 index.html 以某种方式进入了我的 /public 目录,而 nginx 正在加载它而不是模板。不过感谢您的建议。
    猜你喜欢
    • 2011-01-08
    • 2011-01-05
    • 2011-10-15
    • 1970-01-01
    • 2015-07-18
    • 2011-01-30
    • 1970-01-01
    • 1970-01-01
    • 2014-08-07
    相关资源
    最近更新 更多