Ruby on rails 这个错误是否表明我在部署到heroku时不应该在嵌入式ruby中链接方法?
在开发过程中,我的rails应用程序运行良好。 但是当我将它部署到heroku时,它产生了如下所示的错误。 我应该避免在嵌入式ruby中链接方法以避免此错误吗Ruby on rails 这个错误是否表明我在部署到heroku时不应该在嵌入式ruby中链接方法?,ruby-on-rails,ruby,heroku,Ruby On Rails,Ruby,Heroku,在开发过程中,我的rails应用程序运行良好。 但是当我将它部署到heroku时,它产生了如下所示的错误。 我应该避免在嵌入式ruby中链接方法以避免此错误吗 2021-05-21T13:26:25.455724+00:00 app[web.1]: [82400545-7eab-4e17-8f42-b90549f74b07] 4: 2021-05-21T13:26:25.455724+00:00 app[web.1]: [82400545-7eab-4e17-8f42-b90549f7
2021-05-21T13:26:25.455724+00:00 app[web.1]: [82400545-7eab-4e17-8f42-b90549f74b07] 4:
2021-05-21T13:26:25.455724+00:00 app[web.1]: [82400545-7eab-4e17-8f42-b90549f74b07] 5: <% @articles.sort_by { |p| p["updated_at"] }.reverse.each do |article| %>
2021-05-21T13:26:25.455726+00:00 app[web.1]: [82400545-7eab-4e17-8f42-b90549f74b07] 6: <div class="card mx-auto" style="width: 50vw;">
2021-05-21T13:26:25.455726+00:00 app[web.1]: [82400545-7eab-4e17-8f42-b90549f74b07] 7: <h5 class="card-header"><%= article.name %></h5>
2021-05-21T13:26:25.455726+00:00 app[web.1]: [82400545-7eab-4e17-8f42-b90549f74b07] 8: <div class="card-body">
2021-05-21T13:26:25.455727+00:00 app[web.1]: [82400545-7eab-4e17-8f42-b90549f74b07]
2021-05-21T13:26:25.455727+00:00 app[web.1]: [82400545-7eab-4e17-8f42-b90549f74b07] app/views/articles/index.html.erb:5:in `sort_by'
2021-05-21T13:26:25.455728+00:00 app[web.1]: [82400545-7eab-4e17-8f42-b90549f74b07] app/views/articles/index.html.erb:5
2021-05-21T13:26:25.483970+00:00 heroku[router]: at=info method=GET path="/" host=deardiaryapp.herokuapp.com request_id=82400545-7eab-4e17-8f42-b90549f74b07 fwd="49.144.135.203" dyno=web.1 connect=0ms service=372ms status=500 bytes=1827 protocol=https
2021-05-21T13:26:25.924087+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=deardiaryapp.herokuapp.com request_id=0cb3e121-25c0-4aa8-a8fd-9b8b0c884dca fwd="49.144.135.203" dyno=web.1 connect=0ms service=4ms status=200 bytes=143 protocol=https
2021-05-21T13:26:25.455724+00:00应用程序[web.1]:[82400545-7eab-4e17-8f42-b90549f74b07]4:
2021-05-21T13:26:25.455724+00:00应用程序[web.1]:[82400545-7eab-4e17-8f42-b90549f74b07]5:
2021-05-21T13:26:25.455726+00:00应用程序[web.1]:[82400545-7eab-4e17-8f42-b90549f74b07]6:
2021-05-21T13:26:25.455726+00:00应用程序[web.1]:[82400545-7eab-4e17-8f42-b90549f74b07]7:
2021-05-21T13:26:25.455726+00:00应用程序[web.1]:[82400545-7eab-4e17-8f42-b90549f74b07]8:
2021-05-21T13:26:25.455727+00:00应用程序[web.1]:[82400545-7eab-4e17-8f42-b90549f74b07]
2021-05-21T13:26:25.455727+00:00应用程序[web.1]:[82400545-7eab-4e17-8f42-b90549f74b07]app/views/articles/index.html.erb:5:在“排序依据”中
2021-05-21T13:26:25.455728+00:00应用程序[web.1]:[82400545-7eab-4e17-8f42-b90549f74b07]app/views/articles/index.html.erb:5
2021-05-21T13:26:25.483970+00:00 heroku[路由器]:at=info method=GET path=“/”host=deardiaryapp.herokuapp.com请求\u id=82400545-7eab-4e17-8f42-b90549f74b07 fwd=“49.144.135.203”dyno=web.1 connect=0ms服务=372ms状态=500字节=1827协议=https
2021-05-21T13:26:25.924087+00:00 heroku[路由器]:at=info method=GET path=“/favicon.ico”host=deardiaryapp.herokuapp.com请求\u id=0cb3e121-25c0-4aa8-a8fd-9b8b0c884dca fwd=“49.144.135.203”dyno=web.1 connect=0ms服务=4ms状态=200字节=143协议=https
我在那里没有看到实际的错误消息,因此很难说是怎么回事。.sort_by{p|p[“updated_at”]}。reverse
部分可能应该作为.order(updated_at::desc)
推送到数据库中。我还对您的开发环境和生产环境之间的差异感到好奇:相同的数据库,数据库中的相同数据,…我打赌nomethoderror(Abc:Xyz的未定义方法“[]”)
其中Abc:Xyz
很可能是nil:NilClass
我编辑了语法,但它仍然在这一行抛出错误。我在开发中使用了Postgresql,并将其推到了生产环境中。您能提供您所显示的行中的上面的行吗?这是日志中唯一的错误