Ruby on rails Heroku上的Rails TypeError,但本地服务器上没有
在我最近一次部署到Heroku的过程中,我的应用程序停止工作了——不过,它在本地运行良好。该应用程序正在Heroku的cedar stack上运行 在跟踪Heroku上的日志后,我发现以下错误:Ruby on rails Heroku上的Rails TypeError,但本地服务器上没有,ruby-on-rails,ruby,ruby-on-rails-3,heroku,Ruby On Rails,Ruby,Ruby On Rails 3,Heroku,在我最近一次部署到Heroku的过程中,我的应用程序停止工作了——不过,它在本地运行良好。该应用程序正在Heroku的cedar stack上运行 在跟踪Heroku上的日志后,我发现以下错误: TypeError ([1] is not a symbol): app/controllers/application_controller.rb:9:in `new_post' 下面是应用程序_controller.rb中的代码: class ApplicationController <
TypeError ([1] is not a symbol):
app/controllers/application_controller.rb:9:in `new_post'
下面是应用程序_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 ApplicationController
以下是该频道的模式:
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
class频道:channel\u发布
有多个:频道订阅
有多个:通道连接
接受\u嵌套的\u属性\u用于:频道\u发布
接受用户的\u嵌套\u属性\u
结束
我似乎不知道是什么导致了这个类型错误,以及为什么它只在部署到Heroku时才会发生。任何帮助都将不胜感激 我最终在这里解决了这个问题——这是一个愚蠢的错误 为了确保数据库没有问题,我使用Heroku的fork命令对应用程序进行了分叉,创建了一个净化/新鲜的环境和干净的数据库
从那以后,同样的错误依然存在,然而,日志给了我更多关于它在哪里的细节。。。结果是我在一个数据库中没有任何条目的对象中循环 您在heroku上迁移了吗?请尝试删除Gemfile.lock,然后进行捆绑安装: