在我最近一次部署到 Heroku 期间,我的应用程序停止工作——不过,它在本地运行良好。该应用程序在 Heroku 的 cedar 堆栈上运行。
在 Heroku 上跟踪日志后,我收集了以下错误:
TypeError ([1] is not a symbol):
app/controllers/application_controller.rb:9:in `new_post'
以下是 application_controller.rb 中的代码:
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :new_post
before_filter :new_channel
def new_post
@new_post = Post.new
@select_channels = current_user.channels.all
end
def new_channel
@new_channel = Channel.new
end
def after_sign_in_path_for(resource)
browse_path
end
end
下面是频道的模型:
class Channel < ActiveRecord::Base
attr_accessible :title, :description, :cover_image, :status, :writable, :visibility
has_one :channel_publication
has_one :user, :through => :channel_publication
has_many :channel_subscriptions
has_many :channel_post_connections
accepts_nested_attributes_for :channel_publication
accepts_nested_attributes_for :user
end
我似乎无法弄清楚导致此 TypeError 的原因,以及为什么它仅在部署到 Heroku 时才会发生。任何帮助,将不胜感激!