No definitions in delayed job #27

Closed
amritk opened this Issue Sep 25, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@amritk

amritk commented Sep 25, 2014

I'm not sure if this is an issue with the gem, but I have the gem working live. However, when I used it in a delayed job I get:

failed with TZInfo::InvalidTimezoneIdentifier: no such file to load -- tzinfo/definitions/America/Vancouver - 1 failed attempts

Everything is setup just as it would be in production. Running rails 2.3.18 on Ruby 1.8.7

@amritk

This comment has been minimized.

Show comment
Hide comment
@amritk

amritk Sep 25, 2014

I am considering just storing the rails timezones, how would I do that with the tzinfo gem? If you do it though rails

ActiveSupport::TimeZone::MAPPING.select {|k, v| v == "America/New_York" }.keys.first

Doesn't support America/Vancouver, but the tzinfo gem does. Now how would I get the rails timezone from the tzinfo gem so I can replace all of the Linux timezones in my db with the rails ones?

amritk commented Sep 25, 2014

I am considering just storing the rails timezones, how would I do that with the tzinfo gem? If you do it though rails

ActiveSupport::TimeZone::MAPPING.select {|k, v| v == "America/New_York" }.keys.first

Doesn't support America/Vancouver, but the tzinfo gem does. Now how would I get the rails timezone from the tzinfo gem so I can replace all of the Linux timezones in my db with the rails ones?

@philr

This comment has been minimized.

Show comment
Hide comment
@philr

philr Sep 25, 2014

Member

The TZInfo::InvalidTimezoneIdentifier error means that the time zone definition file couldn't be found on the Ruby load path.

ActiveSupport 2.3 bundles a cut down version of TZInfo. This only includes the time zones defined by ActiveSupport::TimeZone. If the tzinfo gem is installed, this should be used instead of the bundled version.

I would suggest checking that the tzinfo gem is installed in the environment where you are running your delayed job and that gem 'tzinfo', '~> 0.3.12' can be run without error.

ActiveSupport in Rails only defines a limited selection of time zones. It is unlikely that you'd be able to find one for each of the time zones in the IANA Time Zone Database (as used by TZInfo and most Linux distributions). To convert, you'd have to compare the base offsets and daylight savings rules for each of the zones you use with the ActiveSupport definitions.

I think the equivalent ActiveSupport time zone for America/Vancouver is 'Mountain Time (US & Canada)' (which uses America/Denver). This should be correct for conversions since Canada adopted the United States daylight savings rules, but is likely to give incorrect results for conversions before then.

Member

philr commented Sep 25, 2014

The TZInfo::InvalidTimezoneIdentifier error means that the time zone definition file couldn't be found on the Ruby load path.

ActiveSupport 2.3 bundles a cut down version of TZInfo. This only includes the time zones defined by ActiveSupport::TimeZone. If the tzinfo gem is installed, this should be used instead of the bundled version.

I would suggest checking that the tzinfo gem is installed in the environment where you are running your delayed job and that gem 'tzinfo', '~> 0.3.12' can be run without error.

ActiveSupport in Rails only defines a limited selection of time zones. It is unlikely that you'd be able to find one for each of the time zones in the IANA Time Zone Database (as used by TZInfo and most Linux distributions). To convert, you'd have to compare the base offsets and daylight savings rules for each of the zones you use with the ActiveSupport definitions.

I think the equivalent ActiveSupport time zone for America/Vancouver is 'Mountain Time (US & Canada)' (which uses America/Denver). This should be correct for conversions since Canada adopted the United States daylight savings rules, but is likely to give incorrect results for conversions before then.

@philr philr added the question label Sep 25, 2014

@philr philr closed this Sep 25, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment