<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Millarian &#187; Ruby on Rails</title>
	<atom:link href="http://millarian.com/category/programming/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://millarian.com</link>
	<description>Musings of a startup junkie and Ruby on Rails nerd.</description>
	<lastBuildDate>Sun, 22 Jan 2012 19:39:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Arizona&#8217;s First Ruby Conference &#8211; SunnyConf 2010</title>
		<link>http://millarian.com/programming/ruby-on-rails/arizonas-first-ruby-conference-sunnyconf-2010/</link>
		<comments>http://millarian.com/programming/ruby-on-rails/arizonas-first-ruby-conference-sunnyconf-2010/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 23:45:13 +0000</pubDate>
		<dc:creator>Curtis Miller</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://millarian.com/?p=2597</guid>
		<description><![CDATA[Arizona's first Ruby conference is happening soon. There's a great group of speakers as well as lightning talks and hacking. If you're interested in Ruby, this is a conference you won't want to miss!]]></description>
			<content:encoded><![CDATA[<p>It started as an impromptu chat about getting more Ruby sessions into events like Desert Code Camp. A small group of rubyists met in the courtyard of DeVry University after the lunch break and kicked around some ideas. It seems like only yesterday that the group, which represented about 5 Phoenix companies, was asked &#8220;<strong>Wait&#8230; what about having a Ruby conference in AZ?</strong>&#8221; Now, that idea has blossomed into a full-fledged <a rel="external" href="http://sunnyconf.com">regional Ruby conference, SunnyConf 2010</a>.</p>
<div style="float:right;">
  <iframe  src="http://www.eventbrite.com/countdown-widget?eid=769378231" frameborder="0" height="376" width="220" marginheight="0" marginwidth="0" scrolling="no" ></iframe>
</div>
<p>SunnyConf is a single-track, one day conference taking place Sept. 25th in Phoenix. There will be 8 speakers and a keynote, as well as lightning talks. There will also be time after the conference set aside for hacking. We&#8217;ve managed to pull together a great group of rubyists to share their knowledge. The speakers include:</p>
<ul>
<li><a href="http://ashkenas.com">Jeremy Ashkenas</a> (Keynote)</li>
<li><a href="http://hashrocket.com/people/view/les-hill/">Les Hill</a> &amp; <a href="http://hashrocket.com/people/view/jim-remsik/">Jim Remsik</a> of <a href="http://hashrocket.com">HashRocket</a></li>
<li><a href="http://blog.headius.com/">Charles Nutter</a></li>
<li><a href="http://github.com/bmizerany">Blake Mizerany</a></li>
<li>and <a rel="external" href="http://sunnyconf.com/#speakers">more</a>!</li>
</ul>
<p>You can find all of the date, time and location information in the widget to the right. You can also visit the <a rel="external" href="http://sunnyconf.com">official SunnyConf website</a> or just jump straight over to Eventbrite to <a rel="external" href="http://sunnyconf.eventbrite.com">register for SunnyConf</a>.</p>
<p>Late September is a great time to visit Phoenix! If you live nearby (e.g., Southern California, Nevada, Utah, Colorado, New Mexico, etc.) then we&#8217;re only a short drive, and an even shorter flight, away. If you&#8217;re outside of that area, we have a major international airport, and plane tickets should be pretty cheap <img src='http://millarian.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I encourage you to come out to Arizona in September to learn, hack and meet other rubyists. <strong>I hope to see you at the conference!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://millarian.com/programming/ruby-on-rails/arizonas-first-ruby-conference-sunnyconf-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Honeypot Captchas for Rails</title>
		<link>http://millarian.com/programming/ruby-on-rails/honeypot-captchas-for-rails/</link>
		<comments>http://millarian.com/programming/ruby-on-rails/honeypot-captchas-for-rails/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 23:10:03 +0000</pubDate>
		<dc:creator>Curtis Miller</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://millarian.com/?p=2571</guid>
		<description><![CDATA[Honeypot captchas are a simple, unobtrusive way to try to combat automated form spam. I packaged some work I did a few years ago using this technique in Ruby on Rails forms and created a gem.]]></description>
			<content:encoded><![CDATA[<p>A while ago, I read a few articles on the technique of honeypot captchas and thought it was a pretty simple, but interesting, technique.</p>
<p>Essentially, with honeypot captchas you add fields into public facing forms that you expect to <strong>not</strong> be filled in, then you hide them through CSS (or other means). Since spam bots don&#8217;t usually apply CSS styles, the fields are visible to them, yet styled away for normal users. And we all know how spam bots love to fill in whatever fields they find&#8230; When the form is submitted, you simply check for these honeypot captcha fields to have values. If they do, then you stop processing the request and return as if everything completed a-okay.</p>
<p>I used this technique on a site several years ago and meant to package it into a gem. This weekend, I finally checked that off my todo list! Now, I&#8217;d like your feedback on whether this is useful and what I can do to make it better. Feel free to fork the repository and mess with the code. If you add a feature, please send me a pull request. Thanks!</p>
<p>You can find the repository here: <a rel="external" href="http://github.com/curtis/honeypot-captcha">Honeypot Captcha on Github</a>.</p>
<h3>References</h3>
<ul>
<li><a rel="external" href="http://haacked.com/archive/2007/09/11/honeypot-captcha.aspx">Honeypot Captcha by Phil Haack</a></li>
<li><a rel="external" href="http://nedbatchelder.com/text/stopbots.html">Stopping spambots with hashes and honeypots</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://millarian.com/programming/ruby-on-rails/honeypot-captchas-for-rails/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Quick Tip: Rails Named Bind Variables</title>
		<link>http://millarian.com/programming/ruby-on-rails/quick-tip-rails-named-bind-variables/</link>
		<comments>http://millarian.com/programming/ruby-on-rails/quick-tip-rails-named-bind-variables/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 16:30:28 +0000</pubDate>
		<dc:creator>Curtis Miller</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://millarian.com/?p=2549</guid>
		<description><![CDATA[Sometimes, Rails queries can get long and complicated. Using named bind variables is an easy way to give some context to the query and, when you need to supply the same value to multiple query conditions, can shorten the query parameters.]]></description>
			<content:encoded><![CDATA[<p>Have you ever come across a Ruby on Rails query that has so many conditions that it&#8217;s hard to figure out what is being replaced where? While this can be somewhat mitigated by using <a href="http://millarian.com/programming/ruby-on-rails/quick-tip-named_scope/">Rails named scopes</a>, you can also use named bind variables to make it easier to read. Named bind variables replace the question marks with symbols and you supply a hash with values for the matching symbol keys:</p>
<pre>Company.find(:first, :conditions => [
  "state = :state AND name = :name AND division = :division AND created_at > :some_date",
  { :state => :approved, :name => 'Flatterline', :division => 'First', :some_date => '2009-02-27' }
])</pre>
<p>This is also very handy when you have the same value for multiple parameters, since it will replace all matching bind variables with the value (e.g., the current time).</p>
<pre>Event.find(:first, :conditions => [
  "state = :state AND starts_at <= :now AND ends_at >= :now",
  { :state => :active, :now => Time.zone.now }
])</pre>
<h3>References</h3>
<ul>
<li><a rel="external" href="http://api.rubyonrails.org/classes/ActiveRecord/Base.html">ActiveRecord::Base API documentation</a>
  </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://millarian.com/programming/ruby-on-rails/quick-tip-rails-named-bind-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Tip: Cucumber Works-in-Progress</title>
		<link>http://millarian.com/programming/ruby-on-rails/quick-tip-cucumber-works-in-progress/</link>
		<comments>http://millarian.com/programming/ruby-on-rails/quick-tip-cucumber-works-in-progress/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 16:30:30 +0000</pubDate>
		<dc:creator>Curtis Miller</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://millarian.com/?p=2527</guid>
		<description><![CDATA[Cucumber has a relatively new feature that allows you to tag individual scenarios as "should pass" versus "work-in-progress". Rake tasks are provided that run the two groups of tagged scenarios separately.]]></description>
			<content:encoded><![CDATA[<p>After upgrading to the latest gems, including cucumber and webrat, I noticed a deprecation message when trying to run <strong>rake features</strong>. There are new rake tasks now for running cucumber features:</p>
<p><script src="http://gist.github.com/194601.js"></script></p>
<p>So now, you can indicate which scenarios should pass and which are still be worked on, then run them separately if you like. Simply add some meta-data to your scenarios like this:</p>
<p><script src="http://gist.github.com/194602.js"></script></p>
<p>This will tag the scenario as a test that should work. If you have a work-in-progress, simply tag with <strong>@wip</strong>.</p>
<p>Read about some other <a rel="external" href="http://robots.thoughtbot.com/post/189412598/five-ridiculously-awesome-cucumber-and-webrat">ridiculously awesome cucumber and webrat features</a> on the thoughtbot blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://millarian.com/programming/ruby-on-rails/quick-tip-cucumber-works-in-progress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Tip: Rails Singularization of -ess</title>
		<link>http://millarian.com/programming/ruby-on-rails/quick-tip-rails-singularization-of-ess/</link>
		<comments>http://millarian.com/programming/ruby-on-rails/quick-tip-rails-singularization-of-ess/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 16:30:05 +0000</pubDate>
		<dc:creator>Curtis Miller</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://millarian.com/?p=2515</guid>
		<description><![CDATA[The Ruby on Rails built-in inflections don't handle singularizing words like "business" or "address" correctly. Here's a quick way to make sure it's handled in your Rails project.]]></description>
			<content:encoded><![CDATA[<p>Have you ever created a Ruby on Rails application dealing with businesses or addresses? I&#8217;d be hard pressed to find someone who hasn&#8217;t.</p>
<p>Strangely, though, Rails does not have an inflection that deals with the singularization of these words correctly. From the command line, try singularizing the word &#8220;business&#8221;:</p>
<p><script src="http://gist.github.com/194495.js"></script></p>
<p>While this seems like a contrived situation, it&#8217;s actually not as hard to hit as you&#8217;d think (e.g., common code that needs to singularize the incoming argument). I saw this while using Acl9, a <a rel="external" href="http://github.com/be9/acl9">role-based authorization system for Rails</a>&#8230;</p>
<p><strong>Here&#8217;s a quick fix that you can add to your config/initializers/inflections.rb:</strong></p>
<p><script src="http://gist.github.com/194493.js"></script></p>
<p>You can read more about how this won&#8217;t be fixed in this <a rel="external" href="https://rails.lighthouseapp.com/projects/8994/tickets/2399-incorrect-inflectors-for-business-or-ness">ticket</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://millarian.com/programming/ruby-on-rails/quick-tip-rails-singularization-of-ess/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fixing Multipart Uploads in Rack for Ruby 1.9</title>
		<link>http://millarian.com/programming/ruby-on-rails/fixing-multipart-uploads-in-rack-for-ruby-1-9/</link>
		<comments>http://millarian.com/programming/ruby-on-rails/fixing-multipart-uploads-in-rack-for-ruby-1-9/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 04:05:13 +0000</pubDate>
		<dc:creator>Curtis Miller</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://millarian.com/?p=2536</guid>
		<description><![CDATA[Describes a fatal error in Rack v1.0.0 that may need to be patched until a new version is released. If you're seeing a "invalid byte sequence in US-ASCII" error, then read on!]]></description>
			<content:encoded><![CDATA[<p>There is a slight problem in Rack 1.0.0 that causes a fatal error to be produced when uploading files <= 110K in size. You may need to patch Rack if you see the following error when uploading a file (I saw it with Paperclip):</p>
<p><script src="http://gist.github.com/197155.js"></script></p>
<p><strong>Here's what you do to patch Rack:</strong></p>
<p><script src="http://gist.github.com/197215.js"></script></p>
<p>You should now be back in business. Hopefully it won't be too long before an update is released for Rack that includes the patch.</p>
<p>Happy uploading!</p>
<h3>References</h3>
<ul>
<li><a rel="external" href="https://rails.lighthouseapp.com/projects/8994/tickets/2497-rack-in-rails-232-throws-fatal-error-with-small-uploads">Rails Ticket #2497: Rack in Rails 2.3.2 throws fatal error with small uploads</a></li>
<li><a rel="external" href="http://github.com/rack/rack/commit/44ed4640f077504a49b7f1cabf8d6ad7a13f6441">Rack commit log: Fix multipart uploads on 1.9</a></li>
<li><a rel="external" href="http://rubynyc.wordpress.com/ruby-1-9-1/paperclip-triggering-a-invalid-byte-sequence-in-us-ascii/">Ruby NYC: paperclip triggering a “invalid byte sequence in US-ASCII” ruby 1.9 rails 2.3</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://millarian.com/programming/ruby-on-rails/fixing-multipart-uploads-in-rack-for-ruby-1-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Named Scopes in a Rails Plugin</title>
		<link>http://millarian.com/programming/ruby-on-rails/using-named-scopes-in-a-rails-plugin/</link>
		<comments>http://millarian.com/programming/ruby-on-rails/using-named-scopes-in-a-rails-plugin/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 17:00:23 +0000</pubDate>
		<dc:creator>Curtis Miller</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://millarian.com/?p=2388</guid>
		<description><![CDATA[I encountered a problem after extracting some common functionality into a Rails plugin that contained two named scopes. It was not returning the correct results and it took me a while to figure it out. With the help of Chris Chandler we determined the cause and a solution so that the named scopes work correctly from within a Rails plugin.]]></description>
			<content:encoded><![CDATA[<p>After extracting some common functionality into a Rails plugin, I was quite pleased with the result. The code was now contained and could be used within a model with a single line. Awesome! Except, a problem cropped up that was quite strange. In production mode, we noticed that after modifying some objects to not be visible, they still appeared in the interface as visible objects. Turns out there was an insidious defect in the plugin code I extracted.</p>
<p>The plugin code in question had two named scopes: one for the visible objects and one for the non-visible. The system uses a timestamp to determine if an object is visible or not, so part of the conditions of these named scopes was to check if the object had been marked as not visible earlier than the current time.</p>
<p><script src="http://gist.github.com/151450.js"></script></p>
<p><strong>So, you see the problem, right?</strong></p>
<p>Since this code is contained within the plugin, it will be evaluated once in production mode, meaning that the time will remain whatever it was when the plugin was loaded. This will cause the strange behavior that we saw. By using a lambda, we can ensure that the code is evaluated every time it is run and not just once.</p>
<p><script src="http://gist.github.com/151452.js"></script></p>
<p>Note the use of double curly braces. The outer is for the lambda and the inner if for the hash. This is necessary for this code to work correctly.</p>
<p>Thanks to <a rel="external" href="http://chrischandler.name">Chris Chandler</a> for helping me to figure this out.</p>
<p><strong>Have you seen similar strange behavior in your Rails plugins?</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://millarian.com/programming/ruby-on-rails/using-named-scopes-in-a-rails-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Tip: Override Rails Generated URLs</title>
		<link>http://millarian.com/programming/ruby-on-rails/quick-tip-override-rails-generated-urls/</link>
		<comments>http://millarian.com/programming/ruby-on-rails/quick-tip-override-rails-generated-urls/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 02:00:08 +0000</pubDate>
		<dc:creator>Curtis Miller</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://millarian.com/?p=2374</guid>
		<description><![CDATA[I explore a quick and simple way to change the default URLs generated for a Ruby on Rails resource. With this tip, there's no need to modify the usage of URL helpers or anything else in your code. After making the change URLs for that resource will be generated as you've specified them.]]></description>
			<content:encoded><![CDATA[<p>By default Ruby on Rails resources use the controller name for the URL. For example:</p>
<pre>map.resources :time_entries</pre>
<p>would yield the following URLs</p>
<p><script src="http://gist.github.com/151034.js"></script></p>
<p>What if you want them to be something else entirely? I guess you could rename your controller, update your routes.rb file and everywhere you use a URL helper&#8230; or, <strong>just use the &#8220;as&#8221; modifier</strong>!</p>
<pre>map.resources :time_entries, :as => :time</pre>
<p>now yields the following URLs</p>
<p><script src="http://gist.github.com/151040.js"></script></p>
<p><strong>All of your existing uses of the URL helpers can remain the same and it will generate all URLs correctly. Quick, simple and painless!</strong></p>
<h3>References</h3>
<ul>
<li><a rel="external" href="http://api.rubyonrails.org/classes/ActionController/Resources.html#M000522">Module ActionController::Resources</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://millarian.com/programming/ruby-on-rails/quick-tip-override-rails-generated-urls/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Monitoring Thin using God, with Google Apps Notifications</title>
		<link>http://millarian.com/programming/ruby-on-rails/monitoring-thin-using-god-with-google-apps-notifications/</link>
		<comments>http://millarian.com/programming/ruby-on-rails/monitoring-thin-using-god-with-google-apps-notifications/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 11:08:00 +0000</pubDate>
		<dc:creator>Curtis Miller</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[We&#8217;ve been using God to monitor our Thin processes on Freebootr and set it up to notify us through our Google Apps account. Thought our God config file might be useful to anyone trying to use God with Thin and Google Apps.
Thin configuration

# == God config file
# http://god.rubyforge.org/
# Authors: Gump and michael@glauche.de
#
# Config file for [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve been using <a href="http://god.rubyforge.org">God</a> to monitor our <a href="http://code.macournoyer.com/thin/">Thin</a> processes on <a href="http://freebootr.com">Freebootr</a> and set it up to notify us through our Google Apps account. Thought our God config file might be useful to anyone trying to use God with Thin and Google Apps.</p>
<h3>Thin configuration</h3>
<p>
<pre><code class="ruby"># == God config file
# http://god.rubyforge.org/
# Authors: Gump and michael@glauche.de
#
# Config file for god that configures watches for each instance of a thin server for
# each thin configuration file found in /etc/thin.
# In order to get it working on Ubuntu, I had to make a change to god as noted at
# the following blog:
# http://blog.alexgirard.com/2007/10/25/ruby-one-line-to-save-god/
#
require 'yaml'
config_path = "/etc/thin"

Dir[config_path + "/*.yml"].each do |file|
  config = YAML.load_file(file)
  num_servers = config["servers"] ||= 1

  (0...num_servers).each do |i|
    # UNIX socket cluster use number 0 to 2 (for 3 servers)
    # and tcp cluster use port number 3000 to 3002.
    number = config['socket'] ? i : (config['port'] + i)

    God.watch do |w|
      w.group = "thin-" + File.basename(file, ".yml")
      w.name = w.group + "-#{number}"

      w.interval = 30.seconds

      w.uid = config["user"]
      w.gid = config["group"]

      w.start = "thin start -C #{file} -o #{number}"
      w.start_grace = 10.seconds

      w.stop = "thin stop -C #{file} -o #{number}"
      w.stop_grace = 10.seconds

      w.restart = "thin restart -C #{file} -o #{number}"

      pid_path = config["pid"]
      ext = File.extname(pid_path)

      w.pid_file = pid_path.gsub(/#{ext}$/, ".#{number}#{ext}")

      w.behavior(:clean_pid_file)

      w.start_if do |start|
        start.condition(:process_running) do |c|
          c.interval = 5.seconds
          c.running  = false
          c.notify   = 'developers'
        end
      end

      w.restart_if do |restart|
        restart.condition(:memory_usage) do |c|
          c.above  = 150.megabytes
          c.times  = [3,5] # 3 out of 5 intervals
          c.notify = 'developers'
        end

        restart.condition(:cpu_usage) do |c|
          c.above  = 50.percent
          c.times  = 5
          c.notify = 'developers'
        end
      end

      w.lifecycle do |on|
        on.condition(:flapping) do |c|
          c.to_state     = [:start, :restart]
          c.times        = 5
          c.within       = 5.minutes
          c.transition   = :unmonitored
          c.retry_in     = 10.minutes
          c.retry_times  = 5
          c.retry_within = 2.hours
          c.notify       = 'developers'
        end
      end

      w.transition(:up, :start) do |on|
        on.condition(:process_exits) do |c|
          c.notify = 'developers'
        end
      end
    end
  end
end</code></pre>
</p>
<h3>Email through Google Apps configuration</h3>
<p>
<pre><code class="ruby">require 'tlsmail'
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)

God::Contacts::Email.message_settings = {
  :from =&gt; 'user@domain.com'
}

God::Contacts::Email.server_settings = {
  :address        =&gt; 'smtp.gmail.com',
  :tls            =&gt; 'true',
  :port           =&gt; 587,
  :domain         =&gt; 'domain.com',
  :user_name      =&gt; 'user@domain.com',
  :password       =&gt; '******',
  :authentication =&gt; :plain
}

God.contact(:email) do |c|
  c.name  = 'Dev 1'
  c.email = 'dev1@domain.com'
  c.group = 'developers'
end

God.contact(:email) do |c|
  c.name  = 'Dev 2'
  c.email = 'dev2@domain.com'
  c.group = 'developers'
end</code></pre>
</p>
<h3>References</h3>
<ul>
<li><a href="http://god.rubyforge.org">God</a></li>
<li><a href="http://glauche.de/2008/02/15/a-thin-god/">A Thin God</a></li>
<li><a href="http://railsforum.com/viewtopic.php?pid=75511">A Gmail God</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://millarian.com/programming/ruby-on-rails/monitoring-thin-using-god-with-google-apps-notifications/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Quick Tip: Rails 2.1 Time Zones</title>
		<link>http://millarian.com/programming/ruby-on-rails/quick-tip-rails-2-1-time-zones/</link>
		<comments>http://millarian.com/programming/ruby-on-rails/quick-tip-rails-2-1-time-zones/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 22:29:00 +0000</pubDate>
		<dc:creator>Curtis Miller</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[My last quick tip involved setting your time zone in Ubuntu Hardy, so now, how do you set your time zone in a Ruby on Rails application? Rails 2.1 makes it much easier to manage time zone settings than it was previously.
Add the following to your environment configuration file:
config/environment.rb

config.time_zone = 'Arizona'

Replace Arizona with your own [...]]]></description>
			<content:encoded><![CDATA[<p>My last <a href="http://millarian.com/tags/quick%20tip">quick tip</a> involved <a href="http://millarian.com/2008/9/13/quick-tip-setting-timezone-on-ubuntu-hardy">setting your time zone in Ubuntu Hardy</a>, so now, how do you set your time zone in a Ruby on Rails application? Rails 2.1 makes it much easier to manage time zone settings than it was previously.</p>
<p>Add the following to your environment configuration file:</p>
<h3>config/environment.rb</h3>
<p>
<pre><code class="ruby">config.time_zone = 'Arizona'</code></pre>
</p>
<p>Replace Arizona with your own time zone. You can find a list of valid values by running any of the following rake tasks:</p>
<p>
<pre><code class="sh">rake time:zones:all
rake time:zones:local
rake time:zones:us</code></pre>
</p>
<p>Your data will still be stored in <span class="caps">UTC</span> time, but it will be converted into the specified time zone when it is type cast on retrieval.</p>
<p><strong>Update:</strong> If you set both your server&#8217;s time zone and your applications time zone then you may see some incorrect times. I believe this is because you&#8217;ll be storing local times and the Rails app will be trying to convert them to local &#8211; a double conversion. So be careful.</p>
<h3>References</h3>
<ul>
<li><a href="http://ryandaigle.com/articles/2008/1/25/what-s-new-in-edge-rails-easier-timezones">What&#8217;s New in Edge Rails: Easier Timezones</a></li>
<li><a href="http://mad.ly/2008/04/09/rails-21-time-zone-support-an-overview/">Rails 2.1 Time Zone Support: An Overview</a></li>
<li><a href="http://metautonomo.us/2008/06/02/updating-mysql-datetimes-for-rails-21-time-zones/">Updating MySQL DATETIMEs for Rails 2.1 Time Zones</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://millarian.com/programming/ruby-on-rails/quick-tip-rails-2-1-time-zones/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

