Re: Time zone issue, Rails 3 - Time.zone = set, but heroku still using local server time

2010-05-04 Thread Daryl
I could be wrong but I believe in Rails 3 the options in Initializers
affect the ActiveRecord time (ie. writing to the DB in the local time
zone rather than UTC) but Time Zones set in the controllers are
supposed to make the application honour time zone settings versus the
System Date/Time.

I also thought this was double true if you set it in your
application_controller.

Can anyone confirm? I've run into quite a few things on Rails 3 that
have had bugs (ok, or weirdness between Ruby 1.9.1, Heroku, Rails 3
beta 2/3 or what have you) so just trying to run this one down to
earth.

ciao !
Daryl.

On May 4, 12:09 am, "Matthew A. Brown"  wrote:
> Hi Daryl,
>
> The Time.zone code only affects the behavior of Time.zone
> (Time.zone.now, Time.zone.parse, ActiveRecord's casting of Date
> columns, etc) inside your application; it doesn't have any effect on
> system time (which is what `date` as well as Time.now will give you).
> The best practice is to write your application to always use the
> Time.zone.* functions to deal with times, and not make any assumptions
> about the system time.
>
> Mat
>
>
>
> On Mon, May 3, 2010 at 01:30, Daryl  wrote:
> > Hey there herokuistas,
>
> > So, I'm using Rails 3.0.0.beta3 and am trying to get the default time
> > in my app to be London while the servers, as you know, are on Pacific
> > time (I'm in Aus myself).
>
> > I've set the application_controller.rb to have a before filter which
> > sets the timezone and then sets that to London (I still want AR to
> > write to the DB in UTC, so have not touched the environment/
> > application.rb).
>
> > ===
> >  before_filter :set_timezone
>
> >  def set_timezone
> >    Time.zone = 'London'
> >  end
> > ===
>
> > Checking heroku console `date` *still* shows the machines on Pacific
> > time, as does a check of the code when I got there (it should show
> > Monday but instead stuck on Sunday at the mo).
>
> > Can anyone tell me what I need to do to get the code to see this as
> > London time ?
>
> > Also, I've asked the fine folks at heroku to reset the daily cron to
> > go off at 1.15am London time and just wondering if changing this
> > setting to London time will then affect that daily cron job kicking
> > off.
>
> > Any help appreciated! A bit stumped here. Thanks !
> > Daryl.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Heroku" group.
> > To post to this group, send email to her...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > heroku+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/heroku?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Heroku" group.
> To post to this group, send email to her...@googlegroups.com.
> To unsubscribe from this group, send email to 
> heroku+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/heroku?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Time zone issue, Rails 3 - Time.zone = set, but heroku still using local server time

2010-05-03 Thread Matthew A. Brown
Hi Daryl,

The Time.zone code only affects the behavior of Time.zone
(Time.zone.now, Time.zone.parse, ActiveRecord's casting of Date
columns, etc) inside your application; it doesn't have any effect on
system time (which is what `date` as well as Time.now will give you).
The best practice is to write your application to always use the
Time.zone.* functions to deal with times, and not make any assumptions
about the system time.

Mat

On Mon, May 3, 2010 at 01:30, Daryl  wrote:
> Hey there herokuistas,
>
> So, I'm using Rails 3.0.0.beta3 and am trying to get the default time
> in my app to be London while the servers, as you know, are on Pacific
> time (I'm in Aus myself).
>
> I've set the application_controller.rb to have a before filter which
> sets the timezone and then sets that to London (I still want AR to
> write to the DB in UTC, so have not touched the environment/
> application.rb).
>
> ===
>  before_filter :set_timezone
>
>  def set_timezone
>    Time.zone = 'London'
>  end
> ===
>
> Checking heroku console `date` *still* shows the machines on Pacific
> time, as does a check of the code when I got there (it should show
> Monday but instead stuck on Sunday at the mo).
>
> Can anyone tell me what I need to do to get the code to see this as
> London time ?
>
> Also, I've asked the fine folks at heroku to reset the daily cron to
> go off at 1.15am London time and just wondering if changing this
> setting to London time will then affect that daily cron job kicking
> off.
>
> Any help appreciated! A bit stumped here. Thanks !
> Daryl.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Heroku" group.
> To post to this group, send email to her...@googlegroups.com.
> To unsubscribe from this group, send email to 
> heroku+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/heroku?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Time zone issue, Rails 3 - Time.zone = set, but heroku still using local server time

2010-05-03 Thread Keenan Brock
Hi Daryl,

I'm still living in 2.3 land, but one thing I often see is using Time.now vs 
Time.zone.now

Also, in test_helper (not sure the rails 3.0 equivalent), I needed to set a 
default Time.zone - otherwise the Time.zone is nil, so Time.zone.now throws 
exceptions

--Keenan
On May 3, 2010, at 1:30 AM, Daryl wrote:

> Hey there herokuistas,
> 
> So, I'm using Rails 3.0.0.beta3 and am trying to get the default time
> in my app to be London while the servers, as you know, are on Pacific
> time (I'm in Aus myself).
> 
> I've set the application_controller.rb to have a before filter which
> sets the timezone and then sets that to London (I still want AR to
> write to the DB in UTC, so have not touched the environment/
> application.rb).
> 
> ===
>  before_filter :set_timezone
> 
>  def set_timezone
>Time.zone = 'London'
>  end
> ===
> 
> Checking heroku console `date` *still* shows the machines on Pacific
> time, as does a check of the code when I got there (it should show
> Monday but instead stuck on Sunday at the mo).
> 
> Can anyone tell me what I need to do to get the code to see this as
> London time ?
> 
> Also, I've asked the fine folks at heroku to reset the daily cron to
> go off at 1.15am London time and just wondering if changing this
> setting to London time will then affect that daily cron job kicking
> off.
> 
> Any help appreciated! A bit stumped here. Thanks !
> Daryl.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Heroku" group.
> To post to this group, send email to her...@googlegroups.com.
> To unsubscribe from this group, send email to 
> heroku+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/heroku?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Time zone issue, Rails 3 - Time.zone = set, but heroku still using local server time

2010-05-02 Thread Daryl
Hey there herokuistas,

So, I'm using Rails 3.0.0.beta3 and am trying to get the default time
in my app to be London while the servers, as you know, are on Pacific
time (I'm in Aus myself).

I've set the application_controller.rb to have a before filter which
sets the timezone and then sets that to London (I still want AR to
write to the DB in UTC, so have not touched the environment/
application.rb).

===
  before_filter :set_timezone

  def set_timezone
Time.zone = 'London'
  end
===

Checking heroku console `date` *still* shows the machines on Pacific
time, as does a check of the code when I got there (it should show
Monday but instead stuck on Sunday at the mo).

Can anyone tell me what I need to do to get the code to see this as
London time ?

Also, I've asked the fine folks at heroku to reset the daily cron to
go off at 1.15am London time and just wondering if changing this
setting to London time will then affect that daily cron job kicking
off.

Any help appreciated! A bit stumped here. Thanks !
Daryl.

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.