Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No definitions in delayed job #27

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

No definitions in delayed job #27

amritk opened this issue Sep 25, 2014 · 2 comments
Labels

Comments

@amritk
Copy link

@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
Copy link
Author

@amritk 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
Copy link
Member

@philr 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.