<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.vitarara.org/cms" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Vita Rara: A Life Uncommon - ActiveRecord</title>
 <link>http://www.vitarara.org/cms/taxonomy/term/98/all</link>
 <description></description>
 <language>en</language>
<item>
 <title>Skipping UTC Conversion of Date/DateTime in ActiveRecord</title>
 <link>http://www.vitarara.org/cms/node/170</link>
 <description>&lt;p&gt;I&#039;m in the process of porting an application from Java/Groovy to Ruby on Rails. All of our times are stored in the database in local time. So, I needed ActiveRecord to store a time without converting it to UTC, which 2.2 does by default. (I&#039;m not sure when UTC became the standard though, could have been before 2.2.)&lt;/p&gt;
&lt;p&gt;After some Googling and asking on IRC it was suggested I try:&lt;/p&gt;
&lt;pre&gt;config.active_record.default_timezone = :local&lt;/pre&gt;&lt;p&gt;
This sets the ActiveRecord::Base.default_timezone class attribute. Unfortunately that didn&#039;t seem to have the desired effect. Dates were still stored in UTC but when retrieved via accessors they were converted to local time. Not what I wanted.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.vitarara.org/cms/node/170&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.vitarara.org/cms/node/170#comment</comments>
 <category domain="http://www.vitarara.org/cms/taxonomy/term/98">ActiveRecord</category>
 <category domain="http://www.vitarara.org/cms/taxonomy/term/97">Rails</category>
 <category domain="http://www.vitarara.org/cms/taxonomy/term/82">Ruby</category>
 <pubDate>Tue, 30 Dec 2008 16:54:56 -0500</pubDate>
 <dc:creator>Mark</dc:creator>
 <guid isPermaLink="false">170 at http://www.vitarara.org/cms</guid>
</item>
</channel>
</rss>

