From 0bed93be25e6bcae2b1a74cec70413118be66736 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Tue, 1 Jun 2010 04:12:04 -0300 Subject: Unforce tzinfo from AS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- activesupport/lib/active_support/values/time_zone.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/values') diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb index 2ac5134911..67b37785f5 100644 --- a/activesupport/lib/active_support/values/time_zone.rb +++ b/activesupport/lib/active_support/values/time_zone.rb @@ -1,5 +1,11 @@ require 'active_support/core_ext/object/blank' require 'active_support/core_ext/object/try' +begin + require 'tzinfo' +rescue LoadError => e + $stderr.puts "You don't have tzinfo installed in your application. Please add it to your Gemfile and run bundle install" + raise e +end # The TimeZone class serves as a wrapper around TZInfo::Timezone instances. It allows us to do the following: # @@ -313,7 +319,7 @@ module ActiveSupport # TODO: Preload instead of lazy load for thread safety def self.find_tzinfo(name) - require 'tzinfo' unless defined?(::TZInfo) + require 'active_support/tzinfo' unless defined?(::TZInfo) ::TZInfo::TimezoneProxy.new(MAPPING[name] || name) end -- cgit v1.2.3