ruby-on-railsactionpack

How come helper.distance_of_time_in_words_to_now Time.now works in development but not production


I can call

helper.distance_of_time_in_words_to_now Time.now in development and it works just fine, but for some reason in production I am now getting translation missing: en.datetime.distance_in_words.less_than_x_minutes

What can I do to fix this?

Here is my gemfile:

source 'https://rubygems.org'

ruby '2.0.0'
gem 'rails', '4.0.5'
gem 'pg', '0.17.1'

gem 'sass-rails', '~> 4.0.3'
gem 'coffee-rails', '~> 4.0.1'
gem 'uglifier', '>= 2.5.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
gem "bootstrap-sass", "~> 3.1.1.1"
gem "will_paginate", "~> 3.0.5"
gem "bootstrap-will_paginate", "~> 0.0.10"

gem "redcarpet", "~> 3.1.1"

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0.7'

group :development, :test do
  gem "foreman", "~> 0.63.0"

  gem 'annotate', '~> 2.6.3'
  gem 'rspec-rails', '~> 2.14.2'
  gem "guard-rspec", "~> 4.2.3", :require => false
  gem "factory_girl_rails", "~> 4.4.0"

  gem "guard-spork", "~> 1.5.1"
  gem "spork-rails", "~> 4.0.0"
  # gem 'spork-rails', github: 'sporkrb/spork-rails'
end

group :test do
  gem 'rb-fsevent', '~> 0.9.4', :require => false
  gem "growl", "~> 1.0.3"

  # # Test gems for Linux
  # gem 'rb-inotify', '0.8.8'
  # gem 'libnotify', '0.5.9'

  # # Test gems for Windows
  # gem 'rb-fchange', '0.0.5'
  # gem 'rb-notifu', '0.0.4'
  # gem 'win32console', '1.3.0'
end

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

gem 'dotenv-rails'

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'

# Use unicorn as the app server
gem 'unicorn', '~> 4.8.2'
gem 'unicorn-worker-killer', "~> 0.4.2"

# Authentication
gem "devise", "~> 3.2.4"
gem "cancan", "~> 1.6.10"

gem "geocoder", "~> 1.2.0"

gem "carrierwave", "~> 0.10.0"
gem "mini_magick", "~> 3.7.0"
gem "fog", "~> 1.22.0"
gem "unf", "~> 0.1.3" # for use with the fog gem

gem "validate_url", "~> 0.2.0"

gem 'psych', '~> 2.0.5'

gem 'paper_trail', '~> 3.0.1'
gem 'faraday', '~> 0.9.0'

# Use Capistrano for deployment
group :development do
  gem "capistrano", "~> 3.2.1"
  gem 'capistrano-rbenv', '~> 2.0'
  gem "capistrano-bundler", "~> 1.1.0"
  gem "capistrano-rails", "~> 1.1.0"
end

# Use debugger
# gem 'debugger', group: [:development, :test]

And here if my production.rb:

Example::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

  # Eager load code on boot. This eager loads most of Rails and
  # your application in memory, allowing both thread web servers
  # and those relying on copy on write to perform better.
  # Rake tasks automatically ignore this option for performance.
  config.eager_load = true

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

  # Enable Rack::Cache to put a simple HTTP cache in front of your application
  # Add `rack-cache` to your Gemfile before enabling this.
  # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
  # config.action_dispatch.rack_cache = true

  # Disable Rails's static asset server (Apache or nginx will already do this).
  config.serve_static_assets = false

  # Compress JavaScripts and CSS.
  config.assets.js_compressor = :uglifier
  # config.assets.css_compressor = :sass

  # Do not fallback to assets pipeline if a precompiled asset is missed.
  config.assets.compile = false

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

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

  # 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 = true

  # Set to :debug to see everything in the log.
  config.log_level = :info

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

  # Use a different cache store in production.
  # config.cache_store = :mem_cache_store

  # 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 in app/assets folder are already added.
  # config.assets.precompile += %w( search.js )

  # Ignore bad email addresses and do not raise email delivery errors.
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
  # config.action_mailer.raise_delivery_errors = false

  # 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

  # Disable automatic flushing of the log to improve performance.
  # config.autoflush_log = false

  # Use default logging formatter so that PID and timestamp are not suppressed.
  config.log_formatter = ::Logger::Formatter.new

  # For devise
  config.action_mailer.default_url_options = { :host => 'example.com' }
end

Solution

  • I figured out the problem. i18n gem version 0.6.10 was yanked, but I was using that in my system. As soon as I rolled back to 0.6.9 everything worked fine.