This project is archived and is in readonly mode.
ActiveModel has undeclared dependency on tzinfo
-
Repository
- State changed from new to committed
(from [51be8dbdedd1279d74cd7a7e277c5042f278b8a2]) Move constantize from conversions to inflections.
This removes ActiveModel dependency on TZInfo.
[#4979 ActiveModel has undeclared dependency on tzinfo state:committed]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/51be8dbdedd1279d74cd7a7e277c50... -
Chris Griego
Same bug, different spot. ActiveModel::Serializers::JSON, which you can argue is an optional part of ActiveModel but in that case it is a dependency of ActiveResource.
Steps to reproduce:
$ echo "gem 'activemodel', :require => 'active_model', :git => 'git://github.com/rails/rails.git'" > Gemfile $ bundle install && bundle console Updating git://github.com/rails/rails.git Updating git://github.com/rails/rails.git Using activesupport (3.0.0.beta4) from git://github.com/rails/rails.git (at master) Using builder (2.1.2) from system gems Using i18n (0.4.1) from bundler gems Using activemodel (3.0.0.beta4) from git://github.com/rails/rails.git (at master) Your bundle is complete! Usebundle show [gemname] to see where a bundled gem is installed. >> ActiveModel::Serializers::JSON You don't have tzinfo installed in your application. Please add it to your Gemfile and run bundle install LoadError: no such file to load -- tzinfofrom /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/values/time_zone.rb:4:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/values/time_zone.rb:4 from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/time_with_zone.rb:1:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/time_with_zone.rb:1 from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/time/zones.rb:1:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/time/zones.rb:1 from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/date/calculations.rb:3:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/date/calculations.rb:3 from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/time/calculations.rb:3:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/time/calculations.rb:3 from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/time.rb:19:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/time.rb:19 from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/json/encoding.rb:11:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/json/encoding.rb:11 from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/json.rb:2:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/json.rb:2 from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activemodel/lib/active_model/serializers/json.rb:1:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activemodel/lib/active_model/serializers/json.rb:1 from (irb):1</code>
-
Santiago Pastorino
- Milestone cleared.
- State changed from committed to open
- Importance changed from to Low
I'm pushing a change again, hope that this fix your problem ;)
-
Repository
- State changed from open to committed
(from [cb321546b7aef33fcf5466b61f79bd9198cd12b5]) Time has it own implementation of xmlschema, now AMo doesn't depend on TZInfo
[#4979 ActiveModel has undeclared dependency on tzinfo state:committed]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/cb321546b7aef33fcf5466b61f79bd... -
Chris Griego
I appreciate the effort!
ActiveModel::Serializers::Xml has a similar issue. The good news is that I beefed up how I was iterating over the constants and I also used the required gem and I think this is the last one. The other way I was driving these out is by bundling activeresource and loading ActiveResource::Base.
>> ActiveModel::Serializers::Xml You don't have tzinfo installed in your application. Please add it to your Gemfile and run bundle install LoadError: no such file to load -- tzinfo from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/values/time_zone.rb:4:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/values/time_zone.rb:4 from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/time_with_zone.rb:1:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/time_with_zone.rb:1 from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/time/zones.rb:1:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/time/zones.rb:1 from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/date/calculations.rb:3:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/date/calculations.rb:3 from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/time/calculations.rb:3:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/time/calculations.rb:3 from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/time.rb:19:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/time.rb:19 from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/hash/conversions.rb:2:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/core_ext/hash/conversions.rb:2 from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activemodel/lib/active_model/serializers/xml.rb:4:in `require' from /Users/cgriego/.bundle/ruby/1.8/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activemodel/lib/active_model/serializers/xml.rb:4 -
Santiago Pastorino
Hehe, yeah Chris this is the following refactor ;)
-
Geoff Buesing
- State changed from committed to open
Reopening this because I noticed this patch changes the Time#as_json implementation from:
%(#{strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)})to:
strftime("%Y/%m/%d %H:%M:%S %z")...i.e., the call to formatted_offset has been replaced with the strftime %z directive. %z is non-standard and unreliable, notably on Mac OS X:
ruby-1.8.7-p174 > Time.local(2010) => Fri Jan 01 00:00:00 -0600 2010 ruby-1.8.7-p174 > Time.local(2010).strftime("%z") => "-0500" # NOTE: should be "-0600"!! ruby-1.8.7-p174 > Time.utc(2010).strftime("%z") => "-0500" ruby-1.8.7-p174 > Time.utc(2010) => Fri Jan 01 00:00:00 UTC 2010 ruby-1.8.7-p174 > Time.utc(2010).strftime("%z") => "-0500" # NOTE: should be "+0000"!!Because of this issue, I'm now getting two failing tests on my machine (OS X 10.6.4 w/Ruby 1.8.7-p174):
1) Failure: test_hash_with_time_to_json(TestJSONEncoding) [./test/json/encoding_test.rb:140:in `test_hash_with_time_to_json' /Users/gbuesing/.rvm/gems/ruby-1.8.7-p174/gems/mocha-0.9.8/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:19:in `__send__' /Users/gbuesing/.rvm/gems/ruby-1.8.7-p174/gems/mocha-0.9.8/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:19:in `run']: <"{\"time\":\"2009/01/01 00:00:00 +0000\"}"> expected but was <"{\"time\":\"2009/01/01 00:00:00 -0500\"}">. 2) Failure: test_time(TestJSONEncoding) [./test/json/encoding_test.rb:72:in `test_time' ./test/json/encoding_test.rb:71:in `each' ./test/json/encoding_test.rb:71:in `test_time' /Users/gbuesing/.rvm/gems/ruby-1.8.7-p174/gems/mocha-0.9.8/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:19:in `__send__' /Users/gbuesing/.rvm/gems/ruby-1.8.7-p174/gems/mocha-0.9.8/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb:19:in `run']: <"\"2005/02/01 15:15:10 +0000\""> expected but was <"\"2005/02/01 15:15:10 -0500\"">.This change looks like it just slipped in to this patch; it doesn't seem relevant to what's being fixed. I've attached a patch that reverts the use of %z; tests are back to passing with this.
-
Repository
(from [227e1caea51279fe4687f17e5704d637a21ea15f]) Time#as_json: use Time#formatted_offset instead of strftime %z directive, which is non-standard and inaccurate on some platforms (e.g., Mac OS X).
[#4979 ActiveModel has undeclared dependency on tzinfo]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/227e1caea51279fe4687f17e5704d6... -
Repository
(from [8cc746331c32a6951e5c73c8a21fd32f00680471]) Time#formatted_offset is defined in core_ext/time/conversions
[#4979 ActiveModel has undeclared dependency on tzinfo] http://github.com/rails/rails/commit/8cc746331c32a6951e5c73c8a21fd3...
-
Santiago Pastorino
- State changed from open to resolved
This was finally fixed here http://github.com/rails/rails/commit/f6d7a4d251cae3e425cb62898c50d3...
Great work Chris please check all the constants again to make sure we're not depending on TZInfo.
Anyways if you want to convert to JSON or Xml a time with a zone you will be ending with this error in case you don't have tzinfobegin 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 endSo for this cases you will need to install it.
-
Repository
- State changed from resolved to committed
(from [f6d7a4d251cae3e425cb62898c50d3f070c69d4b]) Removes the dependency that AMo has on tzinfo
[#4979 ActiveModel has undeclared dependency on tzinfo state:committed] http://github.com/rails/rails/commit/f6d7a4d251cae3e425cb62898c50d3...
-
Chris Griego
Both ActiveModel and ActiveResource seem to work great now. Thanks Santiago!
