Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8803991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:29:15+00:00 2026-06-14T01:29:15+00:00

So I get a uninitialized constant Dalli (NameError) when I push my ruby on

  • 0

So I get a uninitialized constant Dalli (NameError) when I push my ruby on rails app to my staging on heroku, but it works fine in production. my production.rb and staging.rb files are the exact same except for a mailer host value. Could someone help? Thanks!

production.rb:

Novulty::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb

  # Code is not reloaded between requests
  config.cache_classes = true

  # Full error reports are disabled and caching is turned on
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  # Enable Rails's static asset server
  config.serve_static_assets = true

  # Compress JavaScripts and CSS
  config.assets.compress = true

  # Compress CSS using yui-compressor gem
  config.assets.css_compressor = :yui

  # Compress JS using uglifier gem
  config.assets.js_compressor = :uglifier

  # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = false

  # Generate digests for assets URLs
  config.assets.digest = true

  # Defaults to nil and saved in location specified by config.assets.prefix
  # config.assets.manifest = YOUR_PATH

  # Specifies the header that your server uses for sending files
  # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx

  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  config.force_ssl = false

  # See everything in the log (default is :info)
  # config.log_level = :debug

  # Prepend all log lines with the following tags
  # config.log_tags = [ :subdomain, :uuid ]

  # Use a different logger for distributed setups
  # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)

  # Enable serving of images, stylesheets, and JavaScripts from an asset server
  # config.action_controller.asset_host = "http://assets.example.com"

  # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
  config.assets.precompile += %w[ *.js *.css ]

  # Enable threaded mode
  # config.threadsafe!

  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  # the I18n.default_locale when a translation can not be found)
  config.i18n.fallbacks = true

  # Send deprecation notices to registered listeners
  config.active_support.deprecation = :notify

  # Log the query plan for queries taking more than this (works
  # with SQLite, MySQL, and PostgreSQL)
  # config.active_record.auto_explain_threshold_in_seconds = 0.5

  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = false
  config.action_mailer.default :charset => "utf-8"

  # Use SMTP to send mail
  config.action_mailer.delivery_method = :smtp

  # Use Gmail to send smtp mail
  config.action_mailer.smtp_settings = {
    :address              => "smtp.gmail.com",
    :port                 => 587,
    :domain               => "novulty.com",
    :user_name            => ENV["GMAIL_USERNAME"],
    :password             => ENV["GMAIL_PASSWORD"],
    :authentication       => :plain,
    :enable_starttls_auto => true
  }

  # Specify what domain to use for mailer URLs
  config.action_mailer.default_url_options = {
    host: "novulty.com"
  }

  # Specify how long an item should stay cached by setting the Cache-Control headers
  config.static_cache_control = "public, max-age=2592000"

  # Specify Dalli as the storage backends for Rails’ built-in Rack::Cache integration
  config.action_dispatch.rack_cache = {
    :metastore    => Dalli::Client.new,
    :entitystore  => 'file:tmp/cache/rack/body',
    :allow_reload => false
  }
end

staging.rb:

Novulty::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb

  # Code is not reloaded between requests
  config.cache_classes = true

  # Full error reports are disabled and caching is turned on
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  # Enable Rails's static asset server
  config.serve_static_assets = true

  # Compress JavaScripts and CSS
  config.assets.compress = true

  # Compress CSS using yui-compressor gem
  config.assets.css_compressor = :yui

  # Compress JS using uglifier gem
  config.assets.js_compressor = :uglifier

  # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = false

  # Generate digests for assets URLs
  config.assets.digest = true

  # Defaults to nil and saved in location specified by config.assets.prefix
  # config.assets.manifest = YOUR_PATH

  # Specifies the header that your server uses for sending files
  # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx

  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  config.force_ssl = false

  # See everything in the log (default is :info)
  # config.log_level = :debug

  # Prepend all log lines with the following tags
  # config.log_tags = [ :subdomain, :uuid ]

  # Use a different logger for distributed setups
  # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)

  # Enable serving of images, stylesheets, and JavaScripts from an asset server
  # config.action_controller.asset_host = "http://assets.example.com"

  # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
  config.assets.precompile += %w[ *.js *.css ]

  # Enable threaded mode
  # config.threadsafe!

  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  # the I18n.default_locale when a translation can not be found)
  config.i18n.fallbacks = true

  # Send deprecation notices to registered listeners
  config.active_support.deprecation = :notify

  # Log the query plan for queries taking more than this (works
  # with SQLite, MySQL, and PostgreSQL)
  # config.active_record.auto_explain_threshold_in_seconds = 0.5

  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = false
  config.action_mailer.default :charset => "utf-8"

  # Use SMTP to send mail
  config.action_mailer.delivery_method = :smtp

  # Use Gmail to send smtp mail
  config.action_mailer.smtp_settings = {
    :address              => "smtp.gmail.com",
    :port                 => 587,
    :domain               => "novulty.com",
    :user_name            => ENV["GMAIL_USERNAME"],
    :password             => ENV["GMAIL_PASSWORD"],
    :authentication       => :plain,
    :enable_starttls_auto => true
  }

  # Specify what domain to use for mailer URLs
  config.action_mailer.default_url_options = {
    host: "novultystaging.herokuapp.com"
  }

  # Specify how long an item should stay cached by setting the Cache-Control headers
  config.static_cache_control = "public, max-age=2592000"

  # Specify Dalli as the storage backends for Rails’ built-in Rack::Cache integration
  config.action_dispatch.rack_cache = {
    :metastore    => Dalli::Client.new,
    :entitystore  => 'file:tmp/cache/rack/body',
    :allow_reload => false
  }
end

production.rb:

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

require 'rails/all'

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  Bundler.require(*Rails.groups(:assets => %w(development test)))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end

module Novulty
  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.

    # Custom directories with classes and modules you want to be autoloadable.
    # config.autoload_paths += %W(#{config.root}/extras)

    # Only load the plugins named here, in the order given (default is alphabetical).
    # :all can be used as a placeholder for all plugins not explicitly named.
    # config.plugins = [ :exception_notification, :ssl_requirement, :all ]

    # Activate observers that should always be running.
    # config.active_record.observers = :cacher, :garbage_collector, :forum_observer

    # 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)'

    # Use dalli cache store in production
    config.cache_store = :dalli_store

    # 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

    # Add Font-Awesome support (add app/assets/font to the asset path)
    config.assets.paths << Rails.root.join("app", "assets", "fonts")

    # Configure the default encoding used in templates for Ruby 1.9.
    config.encoding = "utf-8"

    # Configure sensitive parameters which will be filtered from the log file.
    config.filter_parameters += [:password]

    # Enable escaping HTML in JSON.
    config.active_support.escape_html_entities_in_json = true

    # Use SQL instead of Active Record's schema dumper when creating the database.
    # This is necessary if your schema can't be completely dumped by the schema dumper,
    # like if you have constraints or database-specific column types
    # config.active_record.schema_format = :sql

    # Enforce whitelist mode for mass assignment.
    # This will create an empty whitelist of attributes available for mass-assignment for all models
    # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
    # parameters by using an attr_accessible or attr_protected declaration.
    config.active_record.whitelist_attributes = true

    # Enable the asset pipeline
    config.assets.enabled = true

    # Version of your assets, change this if you want to expire all your assets
    config.assets.version = '1.0'

    config.assets.initialize_on_precompile = false
  end
end

Here is the output of heroku logs --tail --remote staging:

2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:571:in `block in <class:Engine>'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
2012-11-08T02:04:59+00:00 app[web.1]: /app/config/environments/staging.rb:96:in `block in <top (required)>': uninitialized constant Dalli (NameError)
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:24:in `class_eval'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:24:in `configure'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/config/environments/staging.rb:1:in `<top (required)>'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/config/environment.rb:5:in `<top (required)>'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/config.ru:4:in `require'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/config.ru:4:in `block in <main>'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/config.ru:1:in `new'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/config.ru:1:in `<main>'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:50:in `<top (required)>'
2012-11-08T02:04:59+00:00 app[web.1]:   from script/rails:6:in `require'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:55:in `block in <top (required)>'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands/server.rb:70:in `start'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands/server.rb:46:in `app'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
2012-11-08T02:04:59+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
2012-11-08T02:04:59+00:00 app[web.1]:   from script/rails:6:in `<main>'

Feel free to check out my code at http://www.github.com/sambaek/novulty

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T01:29:16+00:00Added an answer on June 14, 2026 at 1:29 am

    Have a look at your Gemfile:

    group :production do
      gem 'dalli'
    end
    

    Bundler does not load Dalli in your staging environment.
    Either move it out of the :production group, so it’s available in all environments, or add it to the :staging environment too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone tell me why I get a NameError - uninitialized constant Sinatra::Default when
The project works fine in Ruby 1.9.2, but I want to use 1.9.3. This
i used ree to test dalli gem, but i got one error: uninitialized constant
In the following code, I get an uninitialized value warning, but only in the
In irb, I do this class Text include FileUtils end I get: NameError: uninitialized
The get works fine and able to post to the database with a test
When I try to run my spec, I get an uninitialized constant error. My
When ever I run make I get this 'uninitialized constant RDoc::RDoc' error rake -T
Rails doesn't seem to be loading the Kaminari gem, as I get an Uninitialized
Background: I get errors whenever I run rake in an older project. (uninitialized constant

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.