【问题标题】:Heroku date_select issue Rails 4.2.5Heroku date_select 问题 Rails 4.2.5
【发布时间】:2016-10-31 04:37:01
【问题描述】:

我在使用 Rails on Heroku 中的 date_select 方法时遇到问题。

我在开发环境中使用 SQLite,在生产环境中使用 PG。

我正在创建发票申请,我想显示发票的创建日期。我可以让一切在开发中完美运行,但不能在生产环境中运行(Heroku)。

这是我所做的:

rails g migration AddDateColumnToInvoices date:date

发票控制器

def invoice_params
  params.require(:invoice).permit(:date)
end

在我的发票_form.html.erb我列出了以下内容:

<div class="field">
<%= f.label :date %><br>
<%= f.date_select :date, prompt: { day: 'Select Day', month: 'Select Month', year: 'Select year' } %>

每当我尝试创建新发票时,我总是会出错,但日志并没有真正帮助我疲惫的眼睛。

日志样本

    2016-06-28T17:51:12.801833+00:00 app[web.1]:   app/views/invoices/new.html.erb:3:in `_app_views_invoices_new_html_erb__2241545454872084121_70216351109340'
2016-06-28T17:51:12.801833+00:00 app[web.1]: 
2016-06-28T17:51:12.801834+00:00 app[web.1]: 
2016-06-28T17:51:12.801826+00:00 app[web.1]:     19:   </div>
2016-06-28T17:51:12.801826+00:00 app[web.1]:     20:   <div class="field">
2016-06-28T17:51:12.801827+00:00 app[web.1]:     21:     <%= f.label :date %><br>
2016-06-28T17:51:12.801828+00:00 app[web.1]:     22:     <%= f.date_select :date, prompt: { day: 'Select Day', month: 'Select Month', year: 'Select year' } %>
2016-06-28T17:51:12.801829+00:00 app[web.1]:     23:   </div>
2016-06-28T17:51:12.801830+00:00 app[web.1]:     24:   <div class="field">
2016-06-28T17:51:12.778720+00:00 app[web.1]: Started GET "/invoices/new" for IP_ADDRESS at 2016-06-28 17:51:12 +0000
2016-06-28T17:51:12.801830+00:00 app[web.1]:     25:     <%= f.label :name %><br>
2016-06-28T17:51:12.801831+00:00 app[web.1]:   app/views/invoices/_form.html.erb:22:in `block in _app_views_invoices__form_html_erb___2635260794193137374_70216354097720'

我还想指出,我已经运行了所有必要的迁移等。

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-4 heroku rails-migrations heroku-postgres


    【解决方案1】:

    终端

    heroku restart
    

    就是这样!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-14
      • 2012-08-29
      • 2013-11-21
      • 2013-05-22
      • 1970-01-01
      • 2023-04-10
      • 2021-02-28
      • 1970-01-01
      相关资源
      最近更新 更多