[英]Rails TypeError on Heroku, but not on local server
During my latest deployment to Heroku, my app stopped working – though, it works fine locally. 在我最新部署到Heroku的过程中,我的应用程序停止运行-尽管在本地运行良好。 The app is running on Heroku's cedar stack.
该应用程序在Heroku的雪松堆栈上运行。
After tailing the logs on Heroku, I've gathered the following error: 将日志记录在Heroku上之后,我收集了以下错误:
TypeError ([1] is not a symbol):
app/controllers/application_controller.rb:9:in `new_post'
Below is the code from application_controller.rb: 下面是来自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
Below is the channel's model: 以下是渠道的模型:
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
I can't seem to figure out what's causing this TypeError, and, why it only occurs when deployed to Heroku. 我似乎无法弄清楚是什么导致此TypeError,以及为什么只有在部署到Heroku时才会发生。 Any help would be appreciated!
任何帮助,将不胜感激!
I ended up resolving the issue here – it was a stupid mistake. 我最终在这里解决了这个问题–这是一个愚蠢的错误。
To ensure it wasn't an issue with the database, I forked the app, using Heroku's fork command – creating a sanitized/fresh environment and a clean database. 为了确保它不是数据库的问题,我使用Heroku的fork命令对应用程序进行了分叉–创建了一个经过清理/刷新的环境和一个干净的数据库。
From there, the same error persisted, however, the logs gave me greater detail as to where it was... and it turned out I was looping through an object that had no existing entries in the database. 从那里开始,同样的错误仍然存在,但是,日志为我提供了有关它在哪里的更多详细信息……而事实证明,我正在遍历数据库中没有现有条目的对象。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.