0

During my latest deployment to Heroku, my app stopped working – though, it works fine locally. The app is running on Heroku's cedar stack.

After tailing the logs on Heroku, I've gathered the following error:

TypeError ([1] is not a symbol):
app/controllers/application_controller.rb:9:in `new_post'

Below is the code from 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. Any help would be appreciated!

cmw
  • 946
  • 2
  • 11
  • 26

1 Answers1

0

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.

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.

cmw
  • 946
  • 2
  • 11
  • 26