Displaying 20 results from an estimated 26 matches for "default_timezone".
2009 Feb 09
3
RSpec Testing ActiveRecord config dependency.
I have the following library code:
def normal_time_now
return DateTime.now.utc if default_timezone == :utc
return DateTime.now
end
This is dependent upon a setting in config/environment.rb
# Make Active Record use UTC-base instead of local time
config.active_record.default_timezone = :utc
I want to test that I get the expected results with the config set to
utc and otherwise. T...
2006 Aug 31
0
time_zone_select Acting Funky
I am using time_zone_select for the first time:
<%= time_zone_select(''user'', ''default_timezone'') %>
I have an instance variable called user and that model has an attribute
called ''default_timezone''.
The list displays and when I submit the form, I see it sends the data:
Parameters: {"user"=>{"auto_update_map"=>"1", "def...
2006 Sep 01
0
time_zone_select Doesn't Update in Save
I am using time_zone_select for the first time:
<%= form.time_zone_select(''default_timezone'') %>
I have an instance variable called user and that model has an attribute
called ''default_timezone''. This is all inside a nice form_form construct.
The list of time zones displays and when I submit the form, I see it sends
the data:
Parameters: {"user"=...
2009 Feb 10
1
config.default_timezone vs. config.time_zone
In config/environment.rb are these statements equivalent?
config.default_timezone = :utc
config.time_zone = "UTC"
If not, then how do they differ in effect?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To...
2009 Jan 26
4
Mocking/Stubbing ActiveRecord.config.default_timezone
...ve_from <= time_now and
(not superseded_after or superseded_after >=
time_now ))
return false
end
The error is that the time_now assignment is not testing whether or not
the default AR time is utc. The correct code is:
def active_row?
if self.class.default_timezone == :utc
time_now = DateTime.now.utc
else
time_now = DateTime.now
end
return true if (effective_from <= time_now and
(not superseded_after or superseded_after >=
time_now ))
return false
end
My question is: How does one vary...
2011 Jan 17
3
Rails 3: Using local timezone on DB
I''m in the process of upgrading my existing Rails 2.3.8 app to Rails
3.0.3.
One problem that I have encountered is how to make rails 3 read/write
date/time data into the DB in localtime.
In Rails 2.3.8, commenting out the ActiveRecord timezone settings did
the trick, however in Rails 3, that doesn''t work as the default is now
UTC.
I have tried setting the config.time_zone to
2010 Jan 26
6
Subclassing ActiveRecord::Base
...g (single
database) to cause me an error. Note that params is my database settings
and omitted for obvious reasons. pages, components, and books are all
tables in the same db.
require ''active_record''
module TestDB
class Inherited < ActiveRecord::Base
self.logger
self.default_timezone :utc
self.establish_connection(params)
end
class Page < Inherited
puts self.name
puts self.table_name
end
class Book < ActiveRecord::Base
puts self.name
puts self.table_name
end
end
class Component < ActiveRecord::Base
puts self.name
puts self.table_name
e...
2009 Sep 14
9
ActiveRecord::StatementInvalid (invalid date) with Oracle
Hello all. I am a novice Ruby on Rails programmer, starting my first
project using a legacy Oracle 10 database. Using ''reverse_scaffold'' I
have created the models/controllers/views for my existing Oracle
tables.
All seems to work well, using /model/index, /model/show for most of my
tables, *except* when one of the tables contains a Oracle ''date''
column, for
2007 Feb 21
2
date helper bug?
I''ve found an issue when trying to use the time_ago_in_words and
distance_of_time_in_words from action view''s date_helper.rb
Using SQL Server, I have a datetime column that gets returned as:
"2007/02/21 09:54:00". When I pass this to time_ago_in_words (which
just passes on to distance_of_time_in_words) it miscalculates the
difference as "9 hours" (...um yeah,
2006 Jul 05
2
Serialized object behaves weird
Hi!
I got a class named EinsatzFilter which I serialized to session. Before
saving to session it works afterwards I keep getting the message:
"undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from
ActiveRecord::Base inherited class.
Code:
class EinsatzFilter
include ApplicationHelper
attr_reader :personen, :monat, :projekte, :kunde
2009 Mar 31
2
TimeWithZone seems in rails 2.3 seems broken...is this the correct behavior?
My environment.rb contains
config.time_zone = ''UTC''
If my understanding is correct, rails should assume time values coming
from the database are UTC, and since config.time_zone is set to ''UTC'',
it should not try to convert the times.
Instead, rails is assuming that the db values are Eastern (my local
zone) and is incorrectly adding four hours to convert to
2006 Jun 07
4
Setting default timezone ENV[''TZ'']=''UTC'' not working on windows?
...onversion, and have some trouble
getting it to work on my Windows machine. Searching the web, I found
http://wiki.rubyonrails.com/rails/pages/HowtoSetDefaultTimeZone
...which explains how to set the default timezone. I''m using an
environment.rb that include the lines:
ActiveRecord::Base.default_timezone = :utc
ENV[''TZ''] = ''US/Eastern''
This works fine on the Unix server running the application (Site5),
where Time.now outputs a UTC time, but on the windows machine the
ENV[''TZ'']=''UTC'' line is either ignored or doesn''t w...
2013 Feb 07
11
Rails change default time zone.
Hello everyone,
I am using rails 3.2.8.
I want to change time zone to New York time.
I changed following, but didn''t work
#config/application.rb
config.time_zone = ''Eastern Time (US & Canada)''
config.active_record.default_timezone = ''Eastern Time (US & Canada)''
If am wrong please clarify.
Thank You!
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rub...
2006 Jun 02
3
Best way to handle different time zones?
We have a project that is hosted in one time zone (say, Pacific Daylight
Time) but the client wants all time recorded in their time zone (say,
Mountain Time). What is the best way to do this? Any recommendations?
Thanks!
Justin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060602/b995e232/attachment.html
2006 Jun 23
0
Multiparameter error
...'s necessary to do this, because Time doesn''t
# support dates before 1970...
class ActiveRecord::ConnectionAdapters::Column
def self.string_to_time(string)
return string unless string.is_a?(String)
time_array = ParseDate.parsedate(string)[0..5]
begin
Time.send(Base.default_timezone, *time_array)
rescue
DateTime.new(*time_array) rescue nil
end
end
end
Any help would be appreciated
Jeff
--
Posted via http://www.ruby-forum.com/.
2005 Apr 04
0
Rails timezone problems / DST
...u find problems like:
Eastern Time (I''m in Boston) is listed as being 18_000 seconds offset
from UTC, but as of 2am this morning, we''re only 14_400 seconds from
UTC.
So if I''ve got an application where I''m saving items with created_at
in UTC (ActiveRecord::Base.default_timezone = :utc), but I want to be
able to display the created times in a user''s local time, so I''ve got
some code like (where @user_tz is an instance of Rails TimeZone)
<%= @user_tz.adjust(@item.created_at) %>
This code was working up until 2am this morning, but as of today all
of...
2009 Jul 28
1
Rails date conversion
The environment.rb file in a Rails 2.3.2 app says:
> Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
Auto-convert to this zone... when?
Also, what are the differences between these two statements?
config.time_zone = xxx
config.active_record.default_timezone = xxx
I ask these questions because I have a scenario whereby an AR-backed
object, when issued the "published_at" method yields a date like "Tue
Jul 28 17:04:58 UTC 2009". However, when *finding* the object, e.g.
Object.first, I get what looks like a UTC date: "2009-07-28...
2011 Jul 20
1
Time.zone is nil creating problems
...b/initializer.rb:561:in
`initialize_time_zone'': Value assigned to config.time_zone not
recognized.Run "rake -D time" for a list of tasks for finding
appropriate time zone names. (RuntimeError)
I have also mentioned these two things in my environment.rb file
config.active_record.default_timezone = :utc
and
ENV[''TZ''] = ''UTC''
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubsc...
2007 Apr 03
1
Some timezone trouble involving tzinfo and postgresql
...ed up a
bit of a stumper in which utc_to_local appears to be adjusting the UTC-
stored time twice.
This is what I''ve done so far:
1. Set ENV[''TZ''] = ''UTC'' in config/environment.rb
2. Uncommented this line in config/environment.rb:
config.active_record.default_timezone = :utc
3. Installed the tzinfo gem.
4. Added a require statement for tzinfo into config/environment.rb:
require ''tzinfo''
5. Added a timezone selector to my user account profiles, and a string
field in the database to support it. Now this topic deserves a
diversion, as the use...
2006 May 22
3
Syntax error when running dispatch.cgi
Hi,
when I execute dispatch.cgi at the command line, I get the following
error message:
[cg@cg rails]$ ./public/dispatch.cgi
./public/dispatch.cgi:3:in `require'':
./public/../config/environment.rb:8: syntax error, unexpected ''<''
(SyntaxError)
<%= ''# '' if freeze %>RAILS_GEM_VERSION = ''<%= Rails::VERSION::STRING %>''