Displaying 20 results from an estimated 50000 matches similar to: "config.default_timezone vs. config.time_zone"
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
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
2007 Apr 03
1
Some timezone trouble involving tzinfo and postgresql
Friends,
So there I was, minding my own business, trying to make my rails app
timezone aware (DST, as well), since it''s all about the timing with
this one. There are a number of excellent articles that I''ve been
working off of, in particular this one internet archived version of
Scott Barron''s very useful article on the subject that is no longer
available at the
2009 Jan 26
4
Mocking/Stubbing ActiveRecord.config.default_timezone
In tracking down a bug in AuthLogic I realized that I had made the same
error in one of my libraries. Knowing what the error was made creating
a test to expose it (using cucumber) rather trivial. However, it has
occurred to me that this sort of issue is far more subtle than I first
appreciated. So, I am looking for some opinions on how to test for this
sort of thing in a more general sense.
At
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
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
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
why doesn't "config.time_zone = 'location'" ensure Time.now gives the time back in this time zone???
2010 Feb 26
1
why doesn't "config.time_zone = 'location'" ensure Time.now gives the time back in this time zone???
Hi,
I''m after a way of ensuring all my Time work (e.g. using Time.now)
uses the time zone I define as default. To do this I''ve set the
following line in config/environment.rb:
config.time_zone = ''Brisbane''
But even after this, if I open up "./script/console" I note that
Time.now doesn''t work. That is I see:
?> Time.now
=> Thu
2011 Apr 14
4
wrong time in application
hey guys,
i''ve got a problem and i really don''t know how to solve it.
when i''m creating a new dataset in my application, the created_at and
updated_at time will be saved in UTF Time (+000).
in my environment.rb i set the following line:
config.time_zone = ''Berlin''
when i''m using the console (script/console) for reading out some example
2011 Jul 20
1
Time.zone is nil creating problems
Hello guys,
I am using ruby 1.9.2-p290 and rails 2.3.11 and when i am trying to
run Time.zone in my console it is showing me nil and when i am trying
to mention it in the environment.rb file by config.time_zone = ''UTC''
it is showing me an error
.rvm/gems/ruby-1.9.2-p290/gems/rails-2.3.11/lib/initializer.rb:561:in
`initialize_time_zone'': Value assigned to
2010 Jan 26
6
Subclassing ActiveRecord::Base
First of all, sorry for the crossposting, but I put this into the Ruby
Forum first of all, but was pointed to this as a more appropriate
location.
I''m using ActiveRecord and ActiveSupport in a non-rails environment
to connect to multiple databases, and I''ve found the following (single
database) to cause me an error. Note that params is my database settings
and omitted 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,
2009 May 12
2
rails 2.3.2 is not generating environment.rb properly
problem: rails 2.3.2 is not generating
config.action_controller.session_store = :active_record_store in
environment.rb
this is the code in environment.rb
---------------------------------------------------------------------------
# Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION =
2011 Nov 11
1
time zone not getting saved in the database
Hello,
Using rails 2.3.9 and ruby 1.8.7
I am trying add time zone in the site according to user''s time zone
(selected by the user from the drop down of time zones)Code is done as
follows, but time zone is not getting saved in the database.
IN Application Controller
before_filter :set_time_zone
def set_time_zone
Time.zone = current_user.time_zone if current_user
end
IN View
2010 Apr 07
2
rails timezone difference in console and production application
Hi all,
I''m on a rails 2.3.5 app. I''ve got my timezone set to ''Brussels'';
config.time_zone = ''Brussels''
When I use mysql I see that a date is stored in UTC (as expected);
e.g. 2010-04-07 15:03:10
When I use console to print out the date it correctly returns;
>> job.created_at.strftime(''%d %b %Y, %H:%M'')
=>
2009 Mar 20
1
Getting a Time Zone abbreviation from the full name?
There''s got to be an easier way...
I am building an event manager and as part of it, the user selects the
time zone of the event from a drop-down list using the
time_zone_select helper. This is stored in the events table as a
string.
Because of legacy data which is stored in UTC, I want to keep the
dates and times in the table as UTC but when I display it, I want to
show the abbreviated
2011 Jun 01
4
missing these required gems: will_paginate
Hi EveryBody,
I hope some one help me.
I am new on ROR so might be problem is silly or Obvious. i had
developed a project and i had use "WILL_PAGINATE" plugin in my app.
It''s working well at localhost.
But when deploying on HEROKU, ALL step is going well but when running
$heroku rake db:migrate
ERROR IS
Missing these required gems:
will_paginate
You''re
2008 Jun 30
1
rake aborted! undefined method `time_zone=' for #
Dear
I have uploaded one project on my account on one of the servers. When
I do migrate
the database rake db:migrate
i get this error
rake aborted! undefined method `time_zone='' for #
any idea on how to solve this problem
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2012 Jun 26
0
Value assigned to config.time_zone not recognized
Hi,
I''m trying to run Puppet on a RHEL 6 box using apache through passenger. I
recently added the Inventory service, but I''m now getting the following
error:
Value assigned to config.time_zone not recognized.Run "rake -D time" for a
list of tasks for finding appropriate time zone names.
I''m not seeing any tell-tell logs from /var/log/httpd/* or
2006 Jun 07
4
Setting default timezone ENV[''TZ'']=''UTC'' not working on windows?
Hi,
I''ve been trying to do timezone conversion, 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''] =