<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>Stuff.</description><title>Steven Xu</title><generator>Tumblr (3.0; @stevenxu)</generator><link>http://stevenxu.ca/</link><item><title>Autoloading in Rails 3</title><description>&lt;p&gt;Rails 3 by default adds these to the autoload paths:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;app/*
vendor/plugins/*/lib
vendor/plugins/*/app/*
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In addition, gems, when they are defined as Rails engines/railties, get each directory in &lt;code&gt;app&lt;/code&gt; added to the autoload path.&lt;/p&gt;

&lt;p&gt;Notable exceptions: Rails does not automatically add its own &lt;code&gt;lib&lt;/code&gt; directory or the &lt;code&gt;lib&lt;/code&gt; directories of any plugins to the load path.&lt;/p&gt;</description><link>http://stevenxu.ca/post/16869107131</link><guid>http://stevenxu.ca/post/16869107131</guid><pubDate>Wed, 01 Feb 2012 12:14:29 -0500</pubDate></item><item><title>Asset fallback paths in Rails 3.1</title><description>&lt;p&gt;Many things can cause your production asset paths to change. When that happens, your previous assets just stop working at all. Moreover, it seems like it would make sense for the bare asset path (without the md5 postfix) should just point to the most recent version of the asset. This little tidbit should take care of all of that.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Myapp::Application.routes.draw do
  match 'assets/:id.:format' =&gt; 'assets#show'
end

class AssetsController &lt; ApplicationController
  def show
    asset_without_digest = "#{params[:id].gsub /-[0-9a-f]{32}$/, ''}.#{params[:format]}"
    new_path = ActionView::Base.new.image_path(asset_without_digest)
    if url_for(params).include? new_path
      head 404
    else
      redirect_to new_path, :status =&gt; 301
    end
  end
end
&lt;/code&gt;&lt;/pre&gt;</description><link>http://stevenxu.ca/post/10096868050</link><guid>http://stevenxu.ca/post/10096868050</guid><pubDate>Sun, 11 Sep 2011 16:54:00 -0400</pubDate></item><item><title>Photo</title><description>&lt;img src="http://30.media.tumblr.com/tumblr_li5vzr0Q8w1qi5e1go1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;</description><link>http://stevenxu.ca/post/3901480524</link><guid>http://stevenxu.ca/post/3901480524</guid><pubDate>Wed, 16 Mar 2011 13:45:27 -0400</pubDate></item></channel></rss>

