Search code examples
ruby-on-railsrubyherokugemfile

Unable to access app once pushed to heroku


I've pushed my app to heroku after some maneuvering around in the gemfile and config/application.rb file

I have config.assets.initialize_on_precompile = false in my application.rb file above my Bundler.require.

Here is the gemfile.

source 'https://rubygems.org'
ruby '2.1.0'

gem 'rails', '4.0.5'

group :development, :test do
    gem 'sqlite3'
end

group :production do
    gem 'pg'
end

gem 'sass-rails', '~> 4.0.2'

gem 'uglifier', '>= 1.3.0'

gem 'coffee-rails', '~> 4.0.0'

gem 'jquery-rails'

gem 'turbolinks'

gem 'jbuilder', '~> 1.2'

group :doc do
  gem 'sdoc', require: false
end

 gem 'bcrypt', '~> 3.1.7'

group :test, :development do
  gem "rspec-rails", "2.13.1"
end

group :test do
  gem "capybara", "2.1.0"
end

group :development do
    gem 'pry-rails'
    gem 'nokogiri', '1.6.3.1'
end

When I try to access the application on heroku I get an:

'Application Error An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.'

Any ideas?

EDIT: Application.rb posted below as requested:

require File.expand_path('../boot', __FILE__)

require 'rails/all'

config.assets.initialize_on_precompile = false

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module Planner
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de
  end
end

Solution

  • It is complaining about the config statement that is on line 5. That needs to be inside the Application class definition, like so:

    require File.expand_path('../boot', __FILE__)
    
    require 'rails/all'
    
    # Require the gems listed in Gemfile, including any gems
    # you've limited to :test, :development, or :production.
    Bundler.require(*Rails.groups)
    
    module Planner
      class Application < Rails::Application
        # Settings in config/environments/* take precedence over those specified here.
        # Application configuration should go into files in config/initializers
        # -- all .rb files in that directory are automatically loaded.
    
        # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
        # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
        # config.time_zone = 'Central Time (US & Canada)'
    
        # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
        # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
        # config.i18n.default_locale = :de
    
        config.assets.initialize_on_precompile = false
      end
    end