<?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>Slash Dot Dash &#187; Ruby on Rails</title>
	<atom:link href="http://www.slashdotdash.net/category/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.slashdotdash.net</link>
	<description>Rolling on Rails</description>
	<lastBuildDate>Wed, 18 Mar 2009 22:03:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Ruby and Rails Magazines available to Buy or download</title>
		<link>http://www.slashdotdash.net/2009/03/18/ruby-and-rails-magazines-available-to-buy-or-download/</link>
		<comments>http://www.slashdotdash.net/2009/03/18/ruby-and-rails-magazines-available-to-buy-or-download/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 22:03:19 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.slashdotdash.net/?p=1200</guid>
		<description><![CDATA[The thriving Ruby and Rails communities have produced a couple of magazines that you can buy (to show your support) or download PDF versions absolutely free. Rails Magazine &#8211; Issue 1 (1st March 2009) The Beginning; 36 pages of Rails goodness. Receiving E-Mail With Rails by Jason Seifer Delegation in Ruby by Khaled al Habache [...]]]></description>
			<content:encoded><![CDATA[<p>The thriving Ruby and Rails communities have produced a couple of magazines that you can buy (to show your support) or download PDF versions absolutely free.</p>
<p><img src="http://www.slashdotdash.net/uploads/2009/03/rails_magazine_1-230x300.jpg" alt="" title="" width="230" height="300" class="alignright size-medium wp-image-1197" /></p>
<h2>Rails Magazine &#8211; Issue 1 (1st March 2009)</h2>
<p>The Beginning; 36 pages of Rails goodness.</p>
<ul>
<li>Receiving E-Mail With Rails by Jason Seifer</li>
<li>Delegation in Ruby by Khaled al Habache</li>
<li>Subscription billing with Saasy by Alex MacCaw</li>
<li>Making the Switch From RSpec to Shoulda by Dan Pickett</li>
<li>Playing Hooky a.k.a. web hooks by John Nunemaker</li>
<li>Adhearsion by Jason Goecke &#038; Jay Phillips</li>
<li>Rails Performance Analysis by Terry Heath</li>
<li>Getting Started with JRuby and JRuby on Rails by Joshua Moore</li>
<li>Extending Rails Through Plugins by John Yerhot</li>
</ul>
<p><a href="http://magcloud.com/browse/Issue/7830">Buy Now</a> or <a href="http://slashdotdash.net/uploads/2009/03/18/rails-magazine-issue1.pdf">Download</a> for free.</p>
<p><img src="http://www.slashdotdash.net/uploads/2009/03/the_rubyist_august_2008-230x300.jpg" alt="the_rubyist_august_2008" title="the_rubyist_august_2008" width="230" height="300" class="alignleft size-medium wp-image-1199" /></p>
<h2>The Rubyist &#8211; Issue 1 (August 2008)</h2>
<blockquote><p>Hampton Catlin, Rein Henrichs, and friends in the first issue of the Rubyist. INSIDE: An interview with Rein Henrichs on Ruby best practices, an interview with Hampton Catlin about Jabl, columns from Giles Bowkett and Rein Henrichs, a Ruby quiz-esque challenge (you can win an iPhone! Yes, you!), building DataMapper adapters, Ben Scofield shares some techniques for auditing your code, using RubyOSA with Evan Light, Yehuda Katz waxes rhapsodic on performance measures in Merb, and learning about building gems with BDD from Jamie van Dyke!</p></blockquote>
<p><a href="http://www.lulu.com/content/3396321">Buy Now</a> or <a href="http://slashdotdash.net/uploads/2009/03/18/the_rubyist_issue_1.pdf">Download</a> for free.</p>
<p><br style="clear:both;" /></p>
<p><img src="http://www.slashdotdash.net/uploads/2009/03/the_rubyist_february_2009-230x300.jpg" alt="the_rubyist_february_2009" title="the_rubyist_february_2009" width="230" height="300" class="alignright size-medium wp-image-1198" /></p>
<h2>The Rubyist &#8211; Issue 2 (February 2009)</h2>
<ul>
<li>Regional conferences with Pat Eyler</li>
<li>Talking about the Rails merge with Zach Inglis, and interviews with DHH, Ted Han, and more</li>
<li>Scott Chacon drops some Git knowledge</li>
<li>Yehuda Katz discusses his journey from Rails to Merb to Rails</li>
<li>Martin Rehfeld shares his solution from last issue&#8217;s homework</li>
<li>Obie Fernandez talks about client managment</li>
<li>Aaron Quint spends some time with Sinatra</li>
<li>Evan David Light talks BDD</li>
<li>Ben Scofield talks about testing iPhone applications using Ruby</li>
<li>Eric Hodel talks about the next generation of RubyGems</li>
<li>Dennis Theisen teaches how to use ActiveMerchant</li>
<li>Carlo Pecchia shows off JRuby</li>
</li>
<p><a href="http://www.lulu.com/content/6438917">Buy Now</a> or <a href="http://slashdotdash.net/uploads/2009/03/18/the_rubyist_issue_2.pdf">Download</a> for free.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdotdash.net/2009/03/18/ruby-and-rails-magazines-available-to-buy-or-download/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sphinx search with delta indexing thanks to Ultrasphinx</title>
		<link>http://www.slashdotdash.net/2008/03/09/sphinx-search-with-delta-indexing-thanks-to-ultrasphinx/</link>
		<comments>http://www.slashdotdash.net/2008/03/09/sphinx-search-with-delta-indexing-thanks-to-ultrasphinx/#comments</comments>
		<pubDate>Sun, 09 Mar 2008 13:58:00 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Evan Weaver has just announced delta indexing support for his UltraSphinx Rails plugin. Delta indexing speeds up your updates by not reindexing the entire dataset every time. First, in your .base file, set the indexer option delta to your maximum interval between full reindexes. A day or a week is good, depending. Add a little [...]]]></description>
			<content:encoded><![CDATA[<p>Evan Weaver has <a href="http://blog.evanweaver.com/articles/2008/03/08/delta-indexing-support-in-ultrasphinx/">just announced delta indexing support</a> for his UltraSphinx Rails plugin.</p>
<blockquote>
<p>Delta indexing speeds up your updates by not reindexing the entire dataset every time.</p>
<p>First, in your .base file, set the indexer option delta to your maximum interval between full reindexes. A day or a week is good, depending. Add a little bit to account for the time it takes the actual index to run:</p>
<p><code>delta = &lt;%= 1.day + 30.minutes %&gt;</code></p>
<p>Now, configure your models for delta indexing in the is_indexed call:</p>
<p><code>is_indexed :fields =&gt; ['created_at', 'title', 'body'], :delta =&gt; true</code></p>
<p>Now you can run <code>rake ultrasphinx:index:delta</code> frequently, and only records that were changed within 1 day will be reindexed. You will need to run rake ultrasphinx:index:main once a day to move the delta contents into the main index.</p>
</blockquote>
<p>From the <a href="http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/files/README.html">UltraSphinx documentation</a>.</p>
<p>I&#8217;ve previously written about how fast Sphinx search is in <a href="http://www.slashdotdash.net/articles/2007/08/06/rails-searching-with-sphinx">Rails searching with Sphinx</a> using the <code>acts_as_sphinx</code> plugin (and also contributed a chapter to the Advanced Rails Recipes book using the UltraSphinx plugin). I&#8217;d now recommend using the UltraSphinx plugin if you want to take advantage of Sphinx for your Rails application.</p>
<p>In my opinion, this completes the &#8216;missing&#8217; piece of functionality and should make Sphinx your default full-text search engine (if you&#8217;re using MySQL).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdotdash.net/2008/03/09/sphinx-search-with-delta-indexing-thanks-to-ultrasphinx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Contributing to &#8220;Advanced Rails Recipes&#8221;</title>
		<link>http://www.slashdotdash.net/2008/02/28/contributing-to-advanced-rails-recipes/</link>
		<comments>http://www.slashdotdash.net/2008/02/28/contributing-to-advanced-rails-recipes/#comments</comments>
		<pubDate>Thu, 28 Feb 2008 23:10:00 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[The latest Beta update to the new Pragmatic Programmers book Advanced Rails Recipes: 72 New Ways to Build Stunning Rails Apps includes two chapters authored by myself. They are both complete rewrites and updates of two of my popular blog posts Rails searching with Sphinx and iPhone on Rails &#8211; Creating an iPhone optimised version [...]]]></description>
			<content:encoded><![CDATA[<p style="float:right"><img src="http://www.slashdotdash.net/images/fr-arr-100.jpg" alt="" /></p>
<p>The latest Beta update to the new Pragmatic Programmers book <a href="http://www.pragprog.com/titles/fr_arr">Advanced Rails Recipes: 72 New Ways to Build Stunning Rails Apps</a> includes two chapters authored by myself.</p>
<p>They are both complete rewrites and updates of two of my popular blog posts <a href="http://www.slashdotdash.net/articles/2007/08/06/rails-searching-with-sphinx">Rails searching with Sphinx</a> and <a href="http://www.slashdotdash.net/articles/2007/12/04/iphone-on-rails-creating-an-iphone-optimised-version-of-your-rails-site-using-iui-and-rails-2">iPhone on Rails &#8211; Creating an iPhone optimised version of your Rails site using iUI and Rails 2</a>.</p>
<p>The new recipes are:</p>
<p style="float:right"><img src="http://www.slashdotdash.net/images/api_search.gif" alt="" /></p>
<ul>
<li><strong>Full-Text Search with Sphinx</strong> &#8211; includes a Rails site that uses Sphinx to index the Rails <span class="caps">API</span>.</li>
</ul>
<p style="float:right"><img src="http://www.slashdotdash.net/images/iphone_todo.gif" alt="" /></p>
<ul>
<li><strong>Support An iPhone Interface</strong> &#8211; with a <span class="caps">TODO</span> list app.</li>
</ul>
<p>Along with these two (worth the purchase price on their own!), there are another 79 great recipes with some of the latest Rails best practices in small, easy to implement chunks.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdotdash.net/2008/02/28/contributing-to-advanced-rails-recipes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby Tidbit: Timeout code execution</title>
		<link>http://www.slashdotdash.net/2008/02/15/ruby-tidbit-timeout-code-execution/</link>
		<comments>http://www.slashdotdash.net/2008/02/15/ruby-tidbit-timeout-code-execution/#comments</comments>
		<pubDate>Fri, 15 Feb 2008 00:39:00 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Just a small tip, if you wish to ensure a snippet of Ruby code doesn&#8217;t run for too long you can use the timeout function. You might want to do this when making a request to a remote server with net/http for example. timeout.rb A way of performing a potentially long-running operation in a thread, [...]]]></description>
			<content:encoded><![CDATA[<p>Just a small tip, if you wish to ensure a snippet of Ruby code doesn&#8217;t run for too long you can use the timeout function. You might want to do this when making a request to a remote server with <code>net/http</code> for example.</p>
<p><a href="http://www.ruby-doc.org/stdlib/libdoc/timeout/rdoc/index.html">timeout.rb</a></p>
<blockquote>
<p>A way of performing a potentially long-running operation in a thread, and terminating it‘s execution if it hasn‘t finished within fixed amount of time.</p>
</blockquote>
<p>Here&#8217;s a quick example using the excellent <a href="http://rfeedparser.rubyforge.org/">rFeedParser</a> (Universal Feed Parser in Ruby) to fetch an <span class="caps">RSS</span> feed.</p>
<pre>
require 'timeout'
require 'zlib'
require 'rubygems'
require 'rfeedparser'

fp = nil
begin
  # Don't take longer than 20 seconds to retrieve &#38; parse an RSS feed
  Timeout::timeout(20) do
    fp = FeedParser.parse("http://feeds.feedburner.com/slashdotdash")
  end
rescue Timeout::Error
  # Too slow!!
end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdotdash.net/2008/02/15/ruby-tidbit-timeout-code-execution/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>London this week; Rails, free pizza &amp; beer and Cominded de-stealth</title>
		<link>http://www.slashdotdash.net/2008/01/21/london-this-week-rails-free-pizza-beer-and-cominded-de-stealth/</link>
		<comments>http://www.slashdotdash.net/2008/01/21/london-this-week-rails-free-pizza-beer-and-cominded-de-stealth/#comments</comments>
		<pubDate>Mon, 21 Jan 2008 23:03:00 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[This Thursday, 24th Jan, is the latest Pizza on Rails event where you can enjoy free pizza &#38; beer, meet-up with fellow Rails developers and find out what Cominded has been working on when we announce our exciting new Rails site. Join the Pizza On Rails mailing list for further details and to RSVP to [...]]]></description>
			<content:encoded><![CDATA[<p style="float:right"><img src="http://www.slashdotdash.net/images/pizzaonrails.gif" alt="" /></p>
<p>This Thursday, 24th Jan, is the latest <a href="http://www.pizzaonrails.com/">Pizza on Rails</a> event where you can enjoy free pizza &#38; beer, <strong>meet-up with fellow Rails developers</strong> and find out what Cominded has been working on when we announce our exciting new Rails site.</p>
<p>Join the Pizza On Rails mailing list for further details and to <span class="caps">RSVP</span> to indicate your attendance. It looks like it&#8217;ll be another great night with almost 100 people already signed up.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdotdash.net/2008/01/21/london-this-week-rails-free-pizza-beer-and-cominded-de-stealth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When did you start working with Rails?</title>
		<link>http://www.slashdotdash.net/2008/01/16/when-did-you-start-working-with-rails/</link>
		<comments>http://www.slashdotdash.net/2008/01/16/when-did-you-start-working-with-rails/#comments</comments>
		<pubDate>Wed, 16 Jan 2008 09:00:00 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Got a copy of Agile Web Development With Rails Wed 9th Nov, 2005 Order #: 202-0160452-2867026 (amazon) Items: 1 x Agile Web Development with Rails Purchased TextMate (and a Mac to run it on)! Announced first Rails site Sat, 29th Apr 2006 trawlr.com online rss agregator Started working professionally with Rails Mon, 5th November 2007 [...]]]></description>
			<content:encoded><![CDATA[<h2>Got a copy of Agile Web Development With Rails</h2>
<pre><code>Wed 9th Nov, 2005
Order #: 202-0160452-2867026 (<a href="http://www.amazon.co.uk">amazon</a>)
Items: 1 x Agile Web Development with Rails</code></pre>
<h2>Purchased TextMate (and a Mac to run it on)!</h2>
<p><img src="http://www.slashdotdash.net/images/textmate.png" alt="" /></p>
<h2>Announced first Rails site</h2>
<pre><code>Sat, 29th Apr 2006
<a href="http://www.slashdotdash.net/articles/2006/04/29/trawlr-com-online-rss-agregator">trawlr.com online rss agregator</a></code></pre>
<h2>Started working professionally with Rails</h2>
<pre><code>Mon, 5th November 2007
<a href="http://www.cominded.com/">Cominded</a></code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdotdash.net/2008/01/16/when-did-you-start-working-with-rails/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>iPhone on Rails &#8211; Creating an iPhone optimised version of your Rails site using iUI and Rails 2</title>
		<link>http://www.slashdotdash.net/2007/12/04/iphone-on-rails-creating-an-iphone-optimised-version-of-your-rails-site-using-iui-and-rails-2/</link>
		<comments>http://www.slashdotdash.net/2007/12/04/iphone-on-rails-creating-an-iphone-optimised-version-of-your-rails-site-using-iui-and-rails-2/#comments</comments>
		<pubDate>Tue, 04 Dec 2007 00:33:00 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[After upgrading trawlr.com to Rails 2 I thought I&#8217;d make use of some of the new features and attempt to create an iPhone version of the site. With Rails 2 you can create a mime type specifically for the iPhone and then use that format in a respond_to block (along with views such as index.iphone.erb). [...]]]></description>
			<content:encoded><![CDATA[<p style="float:right"><a href="http://www.slashdotdash.net/images/iPhone3.gif"><img src="http://www.slashdotdash.net/images/iPhone3p.gif" alt="" /></a></p>
<p style="float:right"><a href="http://www.slashdotdash.net/images/iPhone2.gif"><img src="http://www.slashdotdash.net/images/iPhone2p.gif" alt="" /></a></p>
<p><a href="http://www.slashdotdash.net/articles/2007/12/03/rails-2-upgrade-notes">After upgrading trawlr.com to Rails 2</a> I thought I&#8217;d make use of some of the new features and attempt to create an iPhone version of the site.<br />
With Rails 2 you can create a mime type specifically for the iPhone and then use that format in a <code>respond_to</code> block (along with views such as <code>index.iphone.erb</code>).</p>
<h2>Before you start &#8211; iPhoney</h2>
<p><a href="http://www.marketcircle.com/iphoney/">iPhoney</a> is an indispensable Mac-only tool for aiding the development of an iPhone specific site.</p>
<blockquote>
<p>Looking for a way to see how your web creations will look on iPhone? Look no further. iPhoney gives you a pixel-accurate web browsing environment—powered by Safari—that you can use when developing web sites for iPhone. It&#8217;s the perfect 320 by 480-pixel canvas for your iPhone development. And it&#8217;s free. iPhoney is not an iPhone simulator but instead is designed for web developers who want to create 320 by 480 (or 480 by 320) websites for use with iPhone. It gives you a canvas on which to test the visual quality of your designs.</p>
</blockquote>
<p>Ensure iPhoney&#8217;s user agent is set to <code>iPhone User Agent</code> in the menu.</p>
<h2>iPhone mime type</h2>
<p>Create an iPhone mime type alias using Rails 2 <code>initializers</code>.</p>
<p><code>config/initializers/mime_types</code></p>
<pre>
Mime::Type.register_alias "text/html", :iphone
</pre>
<h2>Detecting iPhone user agents</h2>
<p style="float:right"><a href="http://www.slashdotdash.net/images/iPhone1.gif"><img src="http://www.slashdotdash.net/images/iPhone1p.gif" alt="" /></a></p>
<p>Apple recommends that rather than redirecting iPhone users to an iPhone-optimised version of your site you should instead show the original site with a link to the alternative.</p>
<p>This can be achieved via user agent sniffing; looking for <code>Mobile Safari</code> (as Apple suggests), rather that iPhone or iPod touch, to allow for future device support.</p>
<p>Adding a helper method to <code>application_helper.rb</code> allows a notification message to be shown for <em>only</em> iPhone users (try accessing <a href="http://www.trawlr.com">www.trawlr.com</a> from an iPhone).</p>
<p><code>app/helpers/application_helper.rb</code></p>
<pre>
# Request from an iPhone or iPod touch? (Mobile Safari user agent)
def iphone_user_agent?
  request.env["HTTP_USER_AGENT"] &#38;&#38; request.env["HTTP_USER_AGENT"][/(Mobile\/.+Safari)/]
end
</pre>
<p>In your view, show a message for iPhone user agents directing them to the iPhone version.</p>
<pre>
&lt;% if iphone_user_agent? # Show message for iPhone users -%&gt;
&lt;div class="message"&gt;
    &lt;p&gt;Using an iPhone? &lt;a href="http://iphone.trawlr.com/"&gt;Use the optimised version&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;% end -%&gt;
</pre>
<h2>iPhone subdomain</h2>
<p>Instead of forcing users straight to our iPhone version, we offer them the option by using a separate subdomain (<a href="http://iphone.trawlr.com">iphone.trawlr.com</a>) with a link back to the <em>regular</em> site if they wish. When developing locally I modified my <code>/etc/hosts</code> file as follows so that I could use http://iphone.localhost.com:3000/.</p>
<p><code>/etc/hosts</code></p>
<pre>
127.0.0.1 iphone.localhost.com
</pre>
<p>You may need to flush the <span class="caps">DNS</span> cache after making the changes.</p>
<pre>
sudo dscacheutil -flushcache
</pre>
<h2>Adjust format for iPhone</h2>
<p>I chose to require login for all requests to the iPhone version of the site.</p>
<pre>
class ApplicationController &lt; ActionController::Base
    before_filter :adjust_format_for_iphone
    before_filter :iphone_login_required

private

  # Set iPhone format if request to iphone.trawlr.com
  def adjust_format_for_iphone
    request.format = :iphone if iphone_request?
  end

  # Force all iPhone users to login
  def iphone_login_required
    if iphone_request?
      redirect_to login_path unless logged_in?
    end
  end

  # Return true for requests to iphone.trawlr.com
  def iphone_request?
    return (request.subdomains.first == "iphone" || params[:format] == "iphone")
  end
end
</pre>
<p>Note that <code>sessions_controller.rb</code> (handles login) requires <code>skip_before_filter :iphone_login_required</code>.</p>
<h2>Using iUI and creating iPhone views</h2>
<p>The <a href="http://code.google.com/p/iui/">iUI</a> framework, based on Joe Hewitt&#8217;s iPhone navigation work, hugely simplifies iPhone web development. All you need to do is include the iUI JavaScript and <span class="caps">CSS</span> files along with included images and create your views in a particular structure to have native iPhone behaviour such as sliding menus and <span class="caps">AJAX</span> page loading.</p>
<p>Rails 2 makes it trivial to create different views depending upon the format, including layouts. Our iPhone layout includes a few specifics for iUI and a <code>viewport</code> meta tag for the device.</p>
<p><code>app/views/layouts/application.iphone.erb</code></p>
<pre>
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&gt;
&lt;head&gt;
    &lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;
    &lt;meta id="viewport" name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/&gt;
    &lt;title&gt;&lt;%= @page_title -%&gt;&lt;/title&gt;
  &lt;%= stylesheet_link_tag 'iui' %&gt;
  &lt;%= javascript_include_tag 'iui' %&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div class="toolbar"&gt;
        &lt;h1 id="pageTitle"&gt;&lt;/h1&gt;
        &lt;a id="backButton" class="button" href="#"&gt;&lt;/a&gt;
    &lt;/div&gt;

    &lt;%= yield %&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>When creating your iPhone views you should follow the iUI style guide, an example page is given below. Standard hyperlinks are loaded using <span class="caps">AJAX</span> and <em>slide</em> into view, navigating back is handled by iUI. Links may be prefixed with <code>target="_self"</code> to replace the entire page or <code>target="_replace"</code> to replace the element with the response (using <span class="caps">AJAX</span>).</p>
<p><code>index.iphone.erb</code></p>
<pre>
&lt;ul title="Home" selected="true"&gt;
    &lt;li&gt;&lt;%= link_to 'Example action', example_path %&gt;&lt;/li&gt;
    &lt;li&gt;&lt;%= link_to 'Logout', logout_path, :method =&gt; :delete, :target =&gt; '_self' %&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p><code>show.iphone.erb</code></p>
<pre>
&lt;div class="panel" title="Example" selected="true"&gt;
    &lt;h2&gt;Example Content&lt;/h2&gt;
    &lt;p&gt;Here's some content&lt;/p&gt;
&lt;/div&gt;
</pre>
<p>It&#8217;s important to remember that iUI will load content using <span class="caps">AJAX</span>, thus you <strong>only</strong> need to render a layout (such as <code>application.iphone.erb</code>) for the first request or page of your iPhone site. All following requests should use <code>render :layout =&gt; false</code> (unless loaded into a new page with <code>target="_replace"</code>). If you experience any wierd rendering issues it&#8217;ll most likely be due to this irregularity.</p>
<pre>
respond_to do |format|
    format.iphone do  # action.iphone.erb
      render :layout =&gt; false
    end
end
</pre>
<h2>Show, don&#8217;t tell</h2>
<p>Why not try <a href="http://iphone.trawlr.com/">iphone.trawlr.com</a> for yourself? It&#8217;ll work for your iPhone or any web browser. You&#8217;ll need to register via the <a href="http://www.trawlr.com/">normal site</a> if you don&#8217;t already have an account (quick, no email registration required)!</p>
<h2>References</h2>
<p>The following resources on the new Rails 2 iPhone format ability and iUI library were extremely helpful; the documentation from Apple not so much!</p>
<ul>
<li>http://developer.apple.com/iphone/</li>
<li>http://www.railspikes.com/2007/11/8/iphone-subdomains-with-rails</li>
<li>http://blog.nicksieger.com/articles/2007/09/18/railsconf-europe-david-heinemeier-hansson</li>
<li>http://www.joehewitt.com/blog/introducing_iui.php</li>
<li>http://code.google.com/p/iui/</li>
</ul>
<p>Yes, I&#8217;m still loving the iPhone!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdotdash.net/2007/12/04/iphone-on-rails-creating-an-iphone-optimised-version-of-your-rails-site-using-iui-and-rails-2/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Rails 2 Upgrade Notes</title>
		<link>http://www.slashdotdash.net/2007/12/03/rails-2-upgrade-notes/</link>
		<comments>http://www.slashdotdash.net/2007/12/03/rails-2-upgrade-notes/#comments</comments>
		<pubDate>Mon, 03 Dec 2007 22:59:00 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Over the weekend I decided to try out Rails 2 by upgrading an existing site (http://www.trawlr.com/) from Rails 1.2.6 to Rails 2 RC2. Check for deprecations before you upgrade You may want to check your existing application for deprecated code before upgrading using the following rake task. lib/tasks/rails.rake desc "Checks your app and gently warns [...]]]></description>
			<content:encoded><![CDATA[<p>Over the weekend I decided to try out Rails 2 by upgrading an existing site (http://www.trawlr.com/) from Rails 1.2.6 to Rails 2 <span class="caps">RC2</span>.</p>
<h2>Check for deprecations before you upgrade</h2>
<p>You may want to check your existing application for deprecated code before upgrading using the following rake task.</p>
<p><code>lib/tasks/rails.rake</code></p>
<pre>
desc "Checks your app and gently warns you if you are using deprecated code."
task :deprecated =&gt; :environment do
  deprecated = {
    '@params'    =&gt; 'Use params[] instead',
    '@session'   =&gt; 'Use session[] instead',
    '@flash'     =&gt; 'Use flash[] instead',
    '@request'   =&gt; 'Use request[] instead',
    '@env' =&gt; 'Use env[] instead',
    'find_all'   =&gt; 'Use find(:all) instead',
    'find_first' =&gt; 'Use find(:first) instead',
    'render_partial' =&gt; 'Use render :partial instead',
    'component'  =&gt; 'Use of components are frowned upon',
    'paginate'   =&gt; 'The default paginator is slow. Writing your own may be faster',
    'start_form_tag'   =&gt; 'Use form_for instead',
    'end_form_tag'   =&gt; 'Use form_for instead',
    ':post =&gt; true'   =&gt; 'Use :method =&gt; :post instead'
  }

  deprecated.each do |key, warning|
    puts '--&gt; ' + key
    output = `cd '#{File.expand_path('app', RAILS_ROOT)}' &#38;&#38; grep -n --exclude=*.svn* -r '#{key}' *`
    unless output =~ /^$/
      puts "  !! " + warning + " !!"
      puts '  ' + '.' * (warning.length + 6)
      puts output
    else
      puts "  Clean! Cheers for you!"
    end
    puts
  end
end
</pre>
<p>Use rake to execute the task.</p>
<pre>
rake deprecated
</pre>
<p>With any luck you won&#8217;t get many warnings; it should give you a rough estimate on how long your upgrade may take.</p>
<h2>Getting Rails 2</h2>
<p>First you need to get the <span class="caps">RC2</span> (or newer) tagged Rails source using rake. This downloads the Rails framework to your appliction&#8217;s <code>vender/rails</code> directory.</p>
<pre>
rake rails:freeze:edge TAG=rel_2-0-0_RC2
</pre>
<h3>Upgrade issues</h3>
<p>After upgrading, it&#8217;s worth running your test suite looking for any problems. The following are issues I ran into to get trawlr.com working.</p>
<h4>Singular resources now map to plural controllers &#8211; Override by using the :controller option in <code>routes.rb</code></h4>
<p><code>config/routes.rb</code></p>
<pre>
# Singleton reader resource
map.resource :reader, :controller =&gt; 'reader'
</pre>
<h4><code>with_scope</code> is now protected &#8211; Use .send(:with_scope) to call method</h4>
<p>This caused an issue due to using the <a href="http://blog.hasmanythrough.com/2006/08/19/magic-join-model-creation">magic join model</a> pattern, although the fix is relatively simple.</p>
<pre>
MyModel.send(:with_scope, args)
</pre>
<h4>asset_packager plugin broken &#8211; Apply fix</h4>
<p>The fabulous asset_packager plugin required a quick change to get working again (single-line change).</p>
<pre>
Index: vendor/plugins/asset_packager/lib/synthesis/asset_package_helper.rb
===================================================================
--- vendor/plugins/asset_packager/lib/synthesis/asset_package_helper.rb    (revision 86)
+++ vendor/plugins/asset_packager/lib/synthesis/asset_package_helper.rb    (working copy)
@@ -37,7 +37,7 @@
     private
       # rewrite compute_public_path to allow us to not include the query string timestamp
       # used by ActionView::Helpers::AssetTagHelper
-      def compute_public_path(source, dir, ext, add_asset_id=true)
+      def compute_public_path(source, dir, ext = nil, add_asset_id=true)
         source = source.dup
         source &lt;&lt; ".#{ext}" if File.extname(source).blank?
         unless source =~ %r{^[-a-z]+://}
</pre>
<p>I still prefer this to the new Rails 2 asset merging as it also minifies JS and <span class="caps">CSS</span> files (including stripping comments) and also allows you to specify multiple asset <em>groups</em> (for example one grouping for the main site, another for an iPhone version). A word of caution if you use asset_packager you cannot take advantage of the new Rails 2 asset servers (see below).</p>
<pre>
# DOES NOT work with asset_packager
config.action_controller.asset_host = "http://asset%d.site.com"
</pre>
<h4>Nested route helpers changed &#8211; Must specifiy parent resource</h4>
<p>If you have any nested routes it&#8217;s likely you will have to alter the named route helpers, for example <code>child_path</code> is now <code>parent_child_path</code>.</p>
<h4><code>start_form_tag</code> and <code>end_form_tag</code> have been deprecated &#8211; Quick fix is to replace with <code>form_tag</code> and <code>&lt;/form&gt;</code> respectively.</h4>
<pre>
&lt;%= form_tag articles_path %&gt;
  &lt;%= text_field :article, :title %&gt;
  &lt;%= submit_tag "Save" %&gt;
&lt;/form&gt;
</pre>
<h4><code>render_without_layout</code> has been deprecated &#8211; Use <code>:layout =&gt; false</code> instead.</h4>
<pre>
render :layout =&gt; false
</pre>
<h4>restful_authentication plugin is broken &#8211; Replace <code>redirect_to_url</code> (deprecated) in <code>lib/authenticated_system.rb</code> with to <code>redirect_to</code>.</h4>
<pre>
Index: authenticated_system.rb
===================================================================
--- authenticated_system.rb    (revision 86)
+++ authenticated_system.rb    (working copy)
@@ -94,7 +94,7 @@
     # Redirect to the URI stored by the most recent store_location call or
     # to the passed default.
     def redirect_back_or_default(default)
-      session[:return_to] ? redirect_to_url(session[:return_to]) : redirect_to(default)
+      session[:return_to] ? redirect_to(session[:return_to]) : redirect_to(default)
       session[:return_to] = nil
     end
</pre>
<h2>Optionally, rename your views</h2>
<p>Rails 2 includes some changes to the way views are named. Previously you may have had <code>show.rhtml</code> and <code>show.rjs</code> which now become <code>show.html.erb</code> and <code>show.js.rjs</code> to indicate the mime type and template engines used. You don&#8217;t have to change your <em>old</em> views, but the following rake task should make it a quick change if you decide to. For trawlr.com I chose to use the new format for any new view templates but left the existing ones as they were (I&#8217;ll probably rename as changes are made on an individual basis).</p>
<p><code>lib/tasks/rails.rake</code></p>
<pre>
namespace 'views' do
  desc 'Renames all .rhtml views to .html.erb, .rjs to .js.rjs, .rxml to .xml.builder, and .haml to .html.haml'
  task 'rename' do
    Dir.glob('app/views/**/[^_]*.rhtml').each do |file|
      puts `svn mv #{file} #{file.gsub(/\.rhtml$/, '.html.erb')}`
    end

    Dir.glob('app/views/**/[^_]*.rxml').each do |file|
      puts `svn mv #{file} #{file.gsub(/\.rxml$/, '.xml.builder')}`
    end

    Dir.glob('app/views/**/[^_]*.rjs').each do |file|
      puts `svn mv #{file} #{file.gsub(/\.rjs$/, '.js.rjs')}`
    end
    Dir.glob('app/views/**/[^_]*.haml').each do |file|
      puts `svn mv #{file} #{file.gsub(/\.haml$/, '.html.haml')}`
    end
  end
end
</pre>
<h2>Resources</h2>
<p>For more information on Rails 2 refer to the <a href="http://weblog.rubyonrails.org/2007/9/30/rails-2-0-0-preview-release">preview release blog post</a>. For $9 you can pick up a copy of <a href="http://peepcode.com/products/rails2-pdf">Ryan Daigle&#8217;s worthwhile Rails 2 <span class="caps">PDF</span> book available via peepcode</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdotdash.net/2007/12/03/rails-2-upgrade-notes/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>DHH Keynote @ RailsConf Europe 2007</title>
		<link>http://www.slashdotdash.net/2007/09/27/dhh-keynote-railsconf-europe-2007/</link>
		<comments>http://www.slashdotdash.net/2007/09/27/dhh-keynote-railsconf-europe-2007/#comments</comments>
		<pubDate>Thu, 27 Sep 2007 23:52:00 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[RailsConf Europe 2007 in Berlin finished just over a week ago and for those of us who didn&#8217;t make it along the presentation slides and videos are now appearing online. David Heinemeier Hansson&#8217;s keynote was recorded and published thanks to the guys at Rails on Wave. RailsConf Europe 2007 Presentations DHH Keynote Video (full-screen) Further [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://conferences.oreillynet.com/railseurope/">RailsConf Europe 2007</a> in Berlin finished just over a week ago and for those of us who didn&#8217;t make it along the  presentation slides and videos are now appearing online. David Heinemeier Hansson&#8217;s keynote was recorded and published thanks to the guys at <a href="http://www.railsonwave.com/railsonwave/2007/9/27/dhh-keynote-fixed">Rails on Wave</a>.</p>
<p><a href="http://conferences.oreillynet.com/pub/w/61/presentations.html">RailsConf Europe 2007 Presentations</a></p>
<p><a href="http://railsconfeurope.railsonwave.com/flash/Keynote.swf"><span class="caps">DHH</span> Keynote Video</a> (full-screen)</p>
<p>Further details from <span class="caps">DHH</span>&#8217;s talk have been <a href="http://casperfabricius.com/blog/2007/09/18/railsconf2007-dhh/">blogged in detail</a>. Personally, I&#8217;m really looking forward to the release of Rails 2.0; evolution rather than revolution.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdotdash.net/2007/09/27/dhh-keynote-railsconf-europe-2007/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ruby Hoedown 2007 Presentations</title>
		<link>http://www.slashdotdash.net/2007/08/24/ruby-hoedown-2007-presentations/</link>
		<comments>http://www.slashdotdash.net/2007/08/24/ruby-hoedown-2007-presentations/#comments</comments>
		<pubDate>Fri, 24 Aug 2007 20:15:00 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Videos and slides for every session from the Ruby Hoedown 2007 (August 10th &#8211; 11th) are now available to watch on the confreaks.com site. Haven&#8217;t watched any of these yet but there are a few gems, such as Marcel Molina Jr.&#8217;s keynote on beautiful code. Charity Workshop: Ruby and Rails Testing Techniques Marcel Molina, Jr., [...]]]></description>
			<content:encoded><![CDATA[<p>Videos and slides for every session from the <a href="http://www.rubyhoedown.com/">Ruby Hoedown 2007</a> (August 10th &#8211; 11th) are now available to watch on the <a href="http://rubyhoedown2007.confreaks.com/">confreaks.com</a> site. Haven&#8217;t watched any of these <em>yet</em> but there are a few gems, such as Marcel Molina Jr.&#8217;s keynote on beautiful code.</p>
<p><a href="http://rubyhoedown2007.confreaks.com/session01.html">Charity Workshop: Ruby and Rails Testing Techniques</a><br />
<em>Marcel Molina, Jr., Bruce Tate, Chad Fowler</em></p>
<p><a href="http://rubyhoedown2007.confreaks.com/session02.html">Exploring Merb</a><br />
<em>Ezra Zygmuntowicz</em></p>
<p><a href="http://rubyhoedown2007.confreaks.com/session03.html">Next-Gen VoIP Development with Ruby and Adhearsion</a> <em>Jay Phillips</em></p>
<p><a href="http://rubyhoedown2007.confreaks.com/session04.html">Keynote Address: The Journey</a> <em>Bruce Tate</em></p>
<p><a href="http://rubyhoedown2007.confreaks.com/session05.html">Building Games with Ruby</a> <em>Andrea O.K. Wright</em></p>
<p><a href="http://rubyhoedown2007.confreaks.com/session06.html">Lightning Talks</a> <em>Various Authors</em></p>
<p><a href="http://rubyhoedown2007.confreaks.com/session07.html">Does Ruby Have a Chasm to Cross?</a> <em>Ken Auer</em></p>
<p><a href="http://rubyhoedown2007.confreaks.com/session08.html">Using C to Tune Your Ruby (or Rails) Application</a> <em>Jared Richardson</em></p>
<p><a href="http://rubyhoedown2007.confreaks.com/session09.html">Keynote Address: What makes code beautiful?</a> <em>Marcel Molina, Jr.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.slashdotdash.net/2007/08/24/ruby-hoedown-2007-presentations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
