<?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>jonathanjulian.com &#187; Ruby</title>
	<atom:link href="http://jonathanjulian.com/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanjulian.com</link>
	<description>Ruby, Rails, JavaScript, software development</description>
	<lastBuildDate>Sat, 27 Feb 2010 16:59:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Introduction to delayed_job</title>
		<link>http://jonathanjulian.com/2009/11/introduction-to-delayed_job/</link>
		<comments>http://jonathanjulian.com/2009/11/introduction-to-delayed_job/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 13:03:58 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://jonathanjulian.com/?p=119</guid>
		<description><![CDATA[I gave this short presentation at the November bmore-on-rails meeting last night. Flip Sasser also presented an overview of Resque, and Michael Dotterer showed us a bit about background_job.
We decided that delayed_job is an easy and solid way to get background tasks running in your Rails app, but if you are a massive site that needs [...]]]></description>
			<content:encoded><![CDATA[<p>I gave this short presentation at the <a href="http://www.meetup.com/bmore-on-rails/calendar/11620904/">November</a> <a href="http://www.meetup.com/bmore-on-rails/">bmore-on-rails</a> meeting last night. <a href="http://twitter.com/flipsasser">Flip Sasser</a> also presented an overview of <a href="http://github.com/blog/542-introducing-resque">Resque</a>, and <a href="http://www.workingwithrails.com/person/17379-michael-dotterer">Michael Dotterer</a> showed us a bit about <a href="http://codeforpeople.rubyforge.org/svn/bj/trunk/README">background_job</a>.</p>
<p>We decided that delayed_job is an easy and solid way to get background tasks running in your Rails app, but if you are a massive site that needs a heavy-duty and configurable solution, then Resque may be what you need. Resque&#8217;s complexity makes this a non-trivial decision! Start with delayed_job since it&#8217;s so quick to implement, and you can always choose another solution later.</p>
<div id="__ss_2467230" style="width: 425px; text-align: left;"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" title="Introduction To Delayed Job" href="http://www.slideshare.net/jonathanjulian/introduction-to-delayed-job">Introduction To Delayed Job</a><object style="margin:0px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=introtodelayedjob-091110110012-phpapp01&amp;stripped_title=introduction-to-delayed-job" /><param name="allowfullscreen" value="true" /><embed style="margin:0px" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=introtodelayedjob-091110110012-phpapp01&amp;stripped_title=introduction-to-delayed-job" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<div style="font-size: 11px; font-family: tahoma,arial; height: 26px; padding-top: 2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">documents</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/jonathanjulian">Jonathan Julian</a>.</div>
</div>
<p>Want to get delayed_job running in your app in 10 minutes? Follow the steps in <a href="http://railstips.org/2008/11/19/delayed-gratification-with-rails">Delayed Gratification with Rails</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jonathanjulian.com/2009/11/introduction-to-delayed_job/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Wrapping a div around will_paginate page_entries_info</title>
		<link>http://jonathanjulian.com/2009/11/wrapping-a-div-around-will_paginate-page_entries_info/</link>
		<comments>http://jonathanjulian.com/2009/11/wrapping-a-div-around-will_paginate-page_entries_info/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 20:19:26 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://jonathanjulian.com/?p=116</guid>
		<description><![CDATA[The page_entries_info view helper looks great, but it is just plain text; I can&#8217;t add margin or padding or float it. Here&#8217;s a quick alias_method to wrap it up in a div with the class of your choice.

Just drop that into an file in config/initializers, restart, and get styling!
]]></description>
			<content:encoded><![CDATA[<p>The page_entries_info view helper looks great, but it is just plain text; I can&#8217;t add margin or padding or float it. Here&#8217;s a quick alias_method to wrap it up in a div with the class of your choice.</p>
<p><script src="http://gist.github.com/230245.js"></script></p>
<p>Just drop that into an file in config/initializers, restart, and get styling!</p>
]]></content:encoded>
			<wfw:commentRss>http://jonathanjulian.com/2009/11/wrapping-a-div-around-will_paginate-page_entries_info/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I just entered RPCFN #2</title>
		<link>http://jonathanjulian.com/2009/10/i-just-entered-rpcfn-2/</link>
		<comments>http://jonathanjulian.com/2009/10/i-just-entered-rpcfn-2/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 19:58:20 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://jonathanjulian.com/?p=110</guid>
		<description><![CDATA[I don&#8217;t consider myself a Ruby newbie, but I was drawn to the Ruby Programming Challenge For Newbies #2 today. I&#8217;ll post and explain my solution when the contest is over! Thanks to Chris Strom for submitting the challenge!
]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t consider myself a Ruby newbie, but I was drawn to the <a href="http://rubylearning.com/blog/2009/10/08/rpcfn-average-arrival-time-for-a-flight-2/">Ruby Programming Challenge For Newbies #2</a> today. I&#8217;ll post and explain my solution when the contest is over! Thanks to <a href="http://japhr.blogspot.com/">Chris Strom</a> for <a href="http://twitter.com/eee_c/status/4705290596">submitting</a> the challenge!</p>
]]></content:encoded>
			<wfw:commentRss>http://jonathanjulian.com/2009/10/i-just-entered-rpcfn-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tweeting from RubyNation</title>
		<link>http://jonathanjulian.com/2009/06/tweeting-from-rubynation/</link>
		<comments>http://jonathanjulian.com/2009/06/tweeting-from-rubynation/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 15:09:38 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://jonathanjulian.com/?p=58</guid>
		<description><![CDATA[I&#8217;m posting updates from RubyNation 2009 on Twitter. Follow along with this search.
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m posting updates from <a href="http://rubynation.org">RubyNation</a> 2009 on Twitter. Follow along with <a href="http://search.twitter.com/search?q=rubynation+jonathanjulian">this search</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jonathanjulian.com/2009/06/tweeting-from-rubynation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing Rails formatted routes too soon</title>
		<link>http://jonathanjulian.com/2009/03/removing-rails-formatted-routes-too-soon/</link>
		<comments>http://jonathanjulian.com/2009/03/removing-rails-formatted-routes-too-soon/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 18:54:06 +0000</pubDate>
		<dc:creator>jonathan</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://jonathanjulian.com/?p=26</guid>
		<description><![CDATA[Here&#8217;s something to watch out for when serving different types of content using the Rails respond_to and :format parameters. Browsers don&#8217;t always know exactly what to do when serving non-html content. In my app, we serve many pages as csv as well as html.
Since the formatted_ routes are going to be removed from Rails, I [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s something to watch out for when serving different types of content using the Rails respond_to and :format parameters. Browsers don&#8217;t always know exactly what to do when serving non-html content. In my app, we serve many pages as csv as well as html.<br />
Since the <a href="http://ryandaigle.com/articles/2008/11/27/what-s-new-in-edge-rails-no-more-formatted-routes">formatted_ routes are going to be removed</a> <a href="http://rails.lighthouseapp.com/projects/8994/tickets/1359-add-optional-format-argument-to-named-routes">from Rails</a>, I stopped defining them in favor of simply using the :format parameter.</p>
<p><em><strong>This means the url in the browser location bar will NOT end with &#8220;.csv&#8221;. Don&#8217;t do this on Rails 2.2.2 and earlier!<br />
</strong></em></p>
<p>Rails 2.2.2 properly sets the Content-Type to text/csv. But that&#8217;s not enough for our browser to know what to do with it. Poking around this morning reveals that Numbers on my MacBook Pro will not open the csv file without an extension. Same issue reported by QA on Windows with IE and Firefox and Microsoft Excel. Same results whether you let the browser open the file in an app directly, or Save As and then open it.</p>
<p><em><strong>Along with the content-type, the filename and extension needs to be correct.<br />
</strong></em></p>
<p>I fixed this on the server side, by forcing a disposition header the same way send_data does.</p>
<pre>respond_to do |format|
  format.html
  format.csv { headers["Content-Disposition"] ||= "attachment; filename=\"#{params[:action] + '.csv'}\"" }
end</pre>
<p>Now we get a disposition header, which explicitly tells the browser what type of file it is.</p>
<pre>Content-Disposition: attachment; filename="index.csv"</pre>
<p>This is ugly. Don&#8217;t do it. It won&#8217;t be needed when <a href="http://github.com/rails/rails/commit/fef6c32afe2276dffa0347e25808a86e7a101af1">this patch</a>, which removes the formatted_ routes, it released. It seamlessly keeps support for incoming requests such as &#8220;/posts.csv&#8221; working as they should.</p>
<p>So the moral of the story is: <strong>don&#8217;t be overzealous and stop using formatted routes yet!</strong> When you upgrade your app, just remove the formatted routes from routes.rb and everything will continue to work as it should.</p>
]]></content:encoded>
			<wfw:commentRss>http://jonathanjulian.com/2009/03/removing-rails-formatted-routes-too-soon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
