Displaying 20 results from an estimated 75 matches for "time_zon".
Did you mean:
time_zone
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 form(haml)
f.time_zone_select :time_zone, ActiveSupport::TimeZone.all.sort
IN Environment.rb
config.time_zone = ''UTC''
IN User table added time_zone as string column
--
You received this...
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 Feb 25 16:45:36 -0800 2010
?>
?> Time.zone.now
=> Fri, 26 Feb 2010 10:45:33 EST +10:00
>>...
2006 Jan 30
1
Introduction & time_zone_select with mapped TimeZone question
...Netherlands... I have started using rails a
few weeks ago, I did read the Agile Webdevelopment with Rails book, and
I generally started to love Rails for it''s sheer beauty and intelligent
structure...
However I came across something that puzzles me quite a bit. It''s how to
add a time_zone_select form field using a composed_of class with mapped
utc_offset and name fields...
In my form I have:
<%= time_zone_select(''user'',''time_zone'') %>
In my user-class I have:
composed_of :time_zone, :class_name => ''TimeZone'', :mappi...
2006 Mar 16
5
TimeZone, TZInfo, daylight savings, and composed_of
Does anyone know the best way to track time zone information. There doesn''t
seem to be much documentation on this. So far it seems like a simple db
field like
create table accounts (
id int unsigned not null auto_increment,
name varchar(50) not null,
time_zone varchar(50) not null,
...
primary key (id)
)
and a class like
class Account < AR
...
composed_of :time_zone, :class_name => TimeZone, :mapping => %w(time_zone
name)
end
There also seems to be a TZInfo library that supports daylight savings. It
seems strange that the TimeZone...
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: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TL...
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 post to this group, se...
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
/var/log/messages. Any ideas on where the root of this problem is?
Thanks,
Michael Altfield
--
You received this messa...
2007 Apr 19
1
Time zone mapping from TimeZone to TZInfo::Timezone
Hi. Using this:
<%= time_zone_select("account", "time_zone" %>
I get a list of time zones options, like eg.:
<option value="Athens">(GMT+02:00) Athens</option>
But as I''m using TZInfo::Timezone, I need to map ''Athens'' to
''Europe/Athens'...
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'')
=> "07 Apr 2010, 17:03"
T...
2007 Apr 03
1
Some timezone trouble involving tzinfo and postgresql
...what I mean:
We want to be able to access the user''s timezone attribute as a
TZInfo::Timezone object instance so that we can say things like:
@current_user.tz.utc_to_local(some_date_time_object)
But whenever I used the standard aggregation shown in examples on this
topic, the drop down time_zone_select for TZInfo doesn''t recognize the
user''s previous selection! So I got around that like thus:
i. created a string field on the user model called time_zone
ii. added an accessor tz that will give us the object support
def tz
TZInfo::Timezone.get(self.time_zone)
end...
2008 Sep 18
0
Detect client time_zone
Hi All
How do I determine (on the server-side) for an incoming request the time
zone of the client. I''ve studied the ''request'' parameter but didn''t see
anything like a TZ.
Any suggestion how to do this ?
Cheers
LuCa
ps I need the TZ to convert Dates/Times correctly on a 2nd server (this
2nd server need the TZ!)
--
Posted via http://www.ruby-forum.com/.
2011 Jan 17
3
Rails 3: Using local timezone on DB
...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 local timezone, but Rails 3
still insist on saving in UTC.
Changing the date/time data in my DB is not really an option as there
are other integrated systems that are relying on localized timezone
data.
Is there a way retain the old behavior of Rails 2.3.8?
--
Posted via http://www.ruby-for...
2008 Sep 22
8
TimeZone daylight savings time problems
Here is the following from my console:
>> Time.now
=> Mon Sep 22 11:33:34 +0200 2008
>> Time.now.utc_offset
=> 7200
>> TimeZone[Time.now.utc_offset]
=> #<TimeZone:0x11aea90 @tzinfo=nil, @utc_offset=7200, @name="Athens">
>> Time.now.in_time_zone(TimeZone[Time.now.utc_offset])
=> Mon, 22 Sep 2008 12:34:22 EEST +03:00
(I am in Spain - CET - and running on OS X with the correct timezone)
The Time.now correctly gives me the time, and the correct UTC offset
of 2 hours. It is the summer, so we are 2 hours ahead of UTC. We are
still one hou...
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 version of the time zone value as selected.
For example, if the user created...
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
zo...
2010 Apr 16
1
time_zone_select :priority_zones not working properly
I sent this earlier but I don''t think it ever came through. Sorry if this is a reposting.
When using :priority_zones for time_zone_select in a manner described
by the API docs for ActionView::Helpers::FormOptionsHelper I''m getting
errors.
Here is an API docs example:
time_zone_select( "user", ''time_zone'', TimeZone.us_zones, :default =>
"Pacific Time (US & Canada)")...
2006 Mar 15
7
rails on OS X 10.3.9 not working
...39;'ve installed Ruby 1.8.4 via Darwinports, installed gem 0.8.11 too and
then installed Rails via gem. I''m using OS X 10.3.9.
When I now type rails in the terminal, the following lines appear:
# rails
/opt/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/
active_support/values/time_zone.rb:12: undefined method `attr_reamer''
for TimeZone:Class (NoMethodError)
from
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:21:in
`require''
from
/opt/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/
active_support/dependencies.rb:2...
2006 Mar 08
5
Cisco 7960 SIP - Displaying Time
Is there a way to display the time of the 7960 running firmware 7.4? Im
unable to find any information.
Thanks,
Ben Blakely
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060308/a7e575cc/attachment.htm
2008 Apr 01
12
undefined method `time_zone=' on Rails 2.0.2.9129 on Mac OS X
I just did a gem update and it broke my rails application. I had to
go back to 2.0.2, because 2.0.2.9129 produces this error on Mac OS X
Leopard:
/Users/nicholas/RubyDev/dummy/config/environment.rb:38: undefined
method `time_zone='' for #<Rails::Configuration:0x12c9f24>
(NoMethodError)
from /Library/Ruby/Gems/1.8/gems/rails-2.0.2/lib/initializer.rb:47:in
`run''
from /Users/nicholas/RubyDev/dummy/config/environment.rb:13
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/
ruby/1.8/r...
2006 Jul 17
0
Weird problem with TimeZone::adjust and TimeZone::unadjust. Please help.
...nding this correctly. I have a user model
that is for all of my user accounts. Each user account has a time
zone. I added this line to automatically create a TimeZone object for
that user using their timezone:
composed_of :tz, :class_name => ''TimeZone'', :mapping => %w(time_zone
name)
I also changed my environment.rb to add the following:
ENV[''TZ''] = ''UTC''
Then when I go into the console I get bad results:
>> drew = User.find 1
=> #<User:0x2a96b01cf8 @attributes={"time_zone"=>"Central Time (US &...