我在Heroku上遇到了一个非常奇怪的问题。我有一个如下所示的视图:
= content_for :header_title do
= t('.header_title')
- if @appointments.exists?
%table.table.table-striped.table-bordered.table-hover
%thead
%tr
%th= t('.id')
%th= t('.athena_health_id')
%th= t('.start_time')
%th= t('.duration')
%th= t('.provider')
%th= t('.created_at')
%th= t('.updated_at')
%tbody
= render @appointments
= paginate @appointments
- else
%h3.text-center= t('.appointments_not_found')
%hr/
没有什么特别的。当我访问在Heroku上使用此模板的页面时,会收到以下信息:
ActionView::Template::Error (undefined method `silence' for #<Logger:0x007f7a86267a70>):
测试已通过,在我的本地一切运作正常,但我不知道出了什么问题。Stacktrace 显示问题在于以下这行代码:
= paginate @appointments
我正在使用Rails 5.0和kaminari(1.0.0.alpha)。有什么想法吗?
编辑: 在我的production.rb文件中:
if ENV['RAILS_LOG_TO_STDOUT'].present?
config.logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
end
config.log_formatter = ::Logger::Formatter.new
Logger
的类。你的代码中是否有Logger
类,或者这是在Heroku端出现的问题? - Okomikeruko::Logger
类的silence
方法自Rails4.2以来已被弃用,并在Rails5中被删除。 - NickGnd