【发布时间】:2019-05-08 09:27:16
【问题描述】:
[更新:我的 comment_update_job.rb 文件中有语法错误,我现在正在排除故障] 我正在参加在线 Rails 课程,但我的应用程序突然停止工作。有人可以帮我指出正确的方向来破译heroku日志吗?
这是我的 comment_update.job.rb 文件
class CommentUpdateJob < ApplicationJob
queue_as :default
def perform(comment, current_user)
ProductChannel.broadcast_to(comment.product_id, comment: render_comment(comment, current_user), average_rating: comment.product.average_rating)
end
private
def render_comment(comment, current_user)
CommentsController.render(partial: 'comments/comment', locals: { comment: comment, current_user: current_user })
end
end
这是我的heroku日志:
2018-12-06T16:09:16.954955+00:00 app[web.1]: => Booting Puma
2018-12-06T16:09:16.954980+00:00 app[web.1]: => Rails 5.2.1 application starting in production
2018-12-06T16:09:16.954982+00:00 app[web.1]: => Run `rails server -h` for more startup options
2018-12-06T16:09:16.957071+00:00 app[web.1]: /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require': /app/app/jobs/comment_update_job.rb:12: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)
2018-12-06T16:09:16.957089+00:00 app[web.1]: end
【问题讨论】:
-
在那之前有什么有用的吗?提出请求时会发生这种情况吗?或者,在加载应用程序时?
-
我不这么认为。当我转到应用程序时,它告诉我它无法加载并告诉我在 heroku 日志中查找错误
-
我认为
Exiting语句之前通常会有一些错误信息。 -
我添加了代码的顶部,我无法适应整个日志。顶部有什么帮助吗?谢谢
-
是整个文件吗?它缺少
end和结尾。顺便说一句,我不知道你为什么拿出错误信息。它很有用,没有它,其他读者将无法获得重要信息。
标签: ruby-on-rails ruby heroku ruby-on-rails-5