So, having development and production servers.
development.rb
config.cache_classes = false
config.whiny_nils = true
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_mailer.raise_delivery_errors = false
config.active_support.deprecation = :log
config.action_dispatch.best_standards_support = :builtin
production.rb
config.cache_classes = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.action_dispatch.x_sendfile_header = "X-Sendfile"
config.cache_store = :redis_store, 'redis://localhost:6379/0/cache', { expires_in: 90.minutes, namespace: 'production' }
config.serve_static_assets = false
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(:default, Rails.env) if defined?(Bundler)
Dotenv::Railtie.load
require "sprockets/railtie"
module S2yd
class Application < Rails::Application
config.autoload_paths += %W( #{config.root}/lib #{config.root}/app/forms #{config.root}/app/decorators )
config.time_zone = 'Central Time (US & Canada)'
config.encoding = "utf-8"
config.filter_parameters += [:password, :active_merchant_billing_credit_card, :payment_cc_number, :payment_cc_verification_value, 'credit_card[number]', 'credit_card[verification_value]']
config.assets.enabled = true
config.assets.paths << File.join(Rails.root, 'vendor', 'assets', 'javascripts')
config.assets.paths << File.join(Rails.root, 'vendor', 'assets', 'stylesheets')
config.assets.precompile += %w( .svg .eot .woff .ttf )
config.assets.precompile += %w(
font/*.*
img/*.*
)
config.assets.initialize_on_precompile = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.2'
end
end
on dev machine:
dev@dev:~/www/mxad-mr.-delivery$ date
Wed Aug 12 09:02:41 EDT 2015
on prod machine:
deploy@production-web:~$ date
Wed Aug 12 12:50:13 UTC 2015
on development rails console on development machine:
1.9.3-p484 :010 > Time.zone.now
=> Wed, 12 Aug 2015 06:07:41 PDT -07:00
1.9.3-p484 :015 > Time.now
=> 2015-08-12 09:29:46 -0400
1.9.3-p484 :016 > Time.now.zone
=> "EDT
on production rails console on production machine:
irb(main):018:0> Time.zone.now
=> Wed, 12 Aug 2015 08:08:06 CDT -05:00
irb(main):032:0> Time.now
=> 2015-08-12 13:29:44 +0000
irb(main):033:0> Time.now.zone
=> "UTC"
I expected that Time.zone.now gave us current time in time_zone set in application.rb. But it did't. So, it should be on prod & dev machines rails console the same time zone Central Time (US & Canada) (see application.rb).
Why not?