Reputation: 314
I got this error and makes me crazy.
My desired output is shows the week starting at sunday and after that calculate 10 weeks ago based on that.
Example:
[Sun, 12 Aug 2012, Sun, 05 Aug 2012, Sun, 29 Jul 2012, Sun, 22 Jul 2012, Sun, 15 Jul 2012, Sun, 08 Jul 2012, Sun, 01 Jul 2012, Sun, 24 Jun 2012, Sun, 17 Jun 2012, Sun, 10 Jun 2012, Sun, 03 Jun 2012]
But at my machine it's correctly and return the array above, however at the server is wrong :(
The output at server is:
[Sat, 11 Aug 2012, Sat, 04 Aug 2012, Sat, 28 Jul 2012, Sat, 21 Jul 2012, Sat, 14 Jul 2012, Sat, 07 Jul 2012, Sat, 30 Jun 2012, Sat, 23 Jun 2012, Sat, 16 Jun 2012, Sat, 09 Jun 2012, Sat, 02 Jun 2012]
If I access the app and call the controller from script/console shows wrong but If I recalculate at script/console shows correctly.
My environment:
OS X 10.7.4, ruby 1.8.7 (2012-04-14 patchlevel 361) [i686-darwin11.3.0], rvm 1.10.2, Seg 13 Ago 2012 09:27:46 BRT (system date)
And server environment:
Ubuntu 12.04, ruby 1.8.7 (2012-02-08 MBARI 8/0x8770 on patchlevel 358) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2012.02, rvm 1.14.0 (stable), Mon Aug 13 13:29:13 WEST 2012
Upvotes: 0
Views: 258
Reputation:
Probably a time zone mismatch on your server, try setting your time zone explicitly in config/appliction.rb:
config.time_zone = "Pacific Time (US & Canada)"
A popular solution to this issue is setting a before_filter on your controller that configures the right time zone per user. See: http://railscasts.com/episodes/106-time-zones-in-rails-2-1 for a starting point.
Upvotes: 1