<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Find objects in IRB directly from browser URLs</title>
	<atom:link href="http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/feed/" rel="self" type="application/rss+xml" />
	<link>http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/</link>
	<description>Ruby makes Rails, Javascript makes Ajax, Dr Nic makes Magic</description>
	<lastBuildDate>Mon, 30 Apr 2012 17:04:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: Dr Nic</title>
		<link>http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/comment-page-1/#comment-70742</link>
		<dc:creator>Dr Nic</dc:creator>
		<pubDate>Sat, 05 Jan 2008 08:53:16 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/#comment-70742</guid>
		<description>Matt Aimonetti noted that outside of script/console, there was an error with pluralize missing from String class. #pluralize is an active_scaffold contribution. 

I realise I have the following at the top of my .irbrc file:

&lt;pre&gt;
unless (IRB.conf[:LOAD_MODULES] &#124;&#124; []).join =~ /config\/environment/
  require &#039;active_support&#039;
end
&lt;/pre&gt;

That is, if you&#039;re in irb, and /config/environemtn isn&#039;t loaded, then explicitly load active_support.</description>
		<content:encoded><![CDATA[<p>Matt Aimonetti noted that outside of script/console, there was an error with pluralize missing from String class. #pluralize is an active_scaffold contribution. </p>
<p>I realise I have the following at the top of my .irbrc file:</p>
<pre>
unless (IRB.conf[:LOAD_MODULES] || []).join =~ /config\/environment/
  require 'active_support'
end
</pre>
<p>That is, if you&#8217;re in irb, and /config/environemtn isn&#8217;t loaded, then explicitly load active_support.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthijs Langenberg</title>
		<link>http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/comment-page-1/#comment-70573</link>
		<dc:creator>Matthijs Langenberg</dc:creator>
		<pubDate>Thu, 03 Jan 2008 11:20:59 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/#comment-70573</guid>
		<description>While this is a neat little trick, I really don&#039;t like the tight coupling between the way to access the resource at HTTP level and database level.</description>
		<content:encoded><![CDATA[<p>While this is a neat little trick, I really don&#8217;t like the tight coupling between the way to access the resource at HTTP level and database level.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: saimon</title>
		<link>http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/comment-page-1/#comment-70565</link>
		<dc:creator>saimon</dc:creator>
		<pubDate>Thu, 03 Jan 2008 08:53:42 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/#comment-70565</guid>
		<description>@Dr Nic [&lt;a href=&#039;http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/#comment-70527&#039; rel=&quot;nofollow&quot;&gt;via&lt;/a&gt;] - Cool stuff...Looking good...</description>
		<content:encoded><![CDATA[<p>@Dr Nic [<a href='http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/#comment-70527' rel="nofollow">via</a>] &#8211; Cool stuff&#8230;Looking good&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dr Nic</title>
		<link>http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/comment-page-1/#comment-70527</link>
		<dc:creator>Dr Nic</dc:creator>
		<pubDate>Wed, 02 Jan 2008 20:06:19 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/#comment-70527</guid>
		<description>@saimon [&lt;a href=&#039;http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/#comment-70512&#039; rel=&quot;nofollow&quot;&gt;via&lt;/a&gt;] - Very nice work :)

I added the following when clause to the #evaluate method to support development urls (e.g. http://localhost:3000...)

&lt;pre&gt;
        when /^(http&#124;https):\/\/[a-z.]+:[0-9]+(([0-9]{1,5})?\/.*)?$/ix
          original_evaluate($2.gsub(/(^\/)/,&#039;&#039;), line_no)
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@saimon [<a href='http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/#comment-70512' rel="nofollow">via</a>] &#8211; Very nice work <img src='http://drnicwilliams.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I added the following when clause to the #evaluate method to support development urls (e.g. <a href="http://localhost:3000.." rel="nofollow">http://localhost:3000..</a>.)</p>
<pre>
        when /^(http|https):\/\/[a-z.]+:[0-9]+(([0-9]{1,5})?\/.*)?$/ix
          original_evaluate($2.gsub(/(^\/)/,''), line_no)
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: saimon</title>
		<link>http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/comment-page-1/#comment-70518</link>
		<dc:creator>saimon</dc:creator>
		<pubDate>Wed, 02 Jan 2008 15:23:31 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/#comment-70518</guid>
		<description>http://pastie.caboo.se/133977

This handles url of the type: /users/david

Now only need to figure out /users/david-myopenid-com and we&#039;re all set.

:)</description>
		<content:encoded><![CDATA[<p><a href="http://pastie.caboo.se/133977" rel="nofollow">http://pastie.caboo.se/133977</a></p>
<p>This handles url of the type: /users/david</p>
<p>Now only need to figure out /users/david-myopenid-com and we&#8217;re all set.</p>
<p> <img src='http://drnicwilliams.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: saimon</title>
		<link>http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/comment-page-1/#comment-70513</link>
		<dc:creator>saimon</dc:creator>
		<pubDate>Wed, 02 Jan 2008 13:30:04 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/#comment-70513</guid>
		<description>You&#039;ve now got no excuse to add in support for all restless urls (as far as logical) and package it up into a gem. DO IT NOW :)</description>
		<content:encoded><![CDATA[<p>You&#8217;ve now got no excuse to add in support for all restless urls (as far as logical) and package it up into a gem. DO IT NOW <img src='http://drnicwilliams.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: saimon</title>
		<link>http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/comment-page-1/#comment-70512</link>
		<dc:creator>saimon</dc:creator>
		<pubDate>Wed, 02 Jan 2008 13:22:01 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/#comment-70512</guid>
		<description>RE caboose chat:

http://pastie.caboo.se/133959

:)</description>
		<content:encoded><![CDATA[<p>RE caboose chat:</p>
<p><a href="http://pastie.caboo.se/133959" rel="nofollow">http://pastie.caboo.se/133959</a></p>
<p> <img src='http://drnicwilliams.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Aimonetti</title>
		<link>http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/comment-page-1/#comment-70473</link>
		<dc:creator>Matt Aimonetti</dc:creator>
		<pubDate>Wed, 02 Jan 2008 02:25:45 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/#comment-70473</guid>
		<description>@drnic Hey Gem master, what about packaging all of that in a nice gem a la wirble?</description>
		<content:encoded><![CDATA[<p>@drnic Hey Gem master, what about packaging all of that in a nice gem a la wirble?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dr Nic</title>
		<link>http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/comment-page-1/#comment-70469</link>
		<dc:creator>Dr Nic</dc:creator>
		<pubDate>Wed, 02 Jan 2008 00:46:32 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/#comment-70469</guid>
		<description>@mislav [&lt;a href=&#039;http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/#comment-70460&#039; rel=&quot;nofollow&quot;&gt;via&lt;/a&gt;] - ok, figured out how to support has_many nested_routes, e.g. &lt;code&gt;people/123/addresses&lt;/code&gt;

See the &lt;a href=&quot;http://pastie.textmate.org/133861&quot; rel=&quot;nofollow&quot;&gt;pastie&lt;/a&gt;

NOTE: This assumes there are models Person and Address, and &lt;code&gt;Person.has_many :addresses&lt;/code&gt;

Nifty.</description>
		<content:encoded><![CDATA[<p>@mislav [<a href='http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/#comment-70460' rel="nofollow">via</a>] &#8211; ok, figured out how to support has_many nested_routes, e.g. <code>people/123/addresses</code></p>
<p>See the <a href="http://pastie.textmate.org/133861" rel="nofollow">pastie</a></p>
<p>NOTE: This assumes there are models Person and Address, and <code>Person.has_many :addresses</code></p>
<p>Nifty.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dr Nic</title>
		<link>http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/comment-page-1/#comment-70465</link>
		<dc:creator>Dr Nic</dc:creator>
		<pubDate>Wed, 02 Jan 2008 00:27:53 +0000</pubDate>
		<guid isPermaLink="false">http://drnicwilliams.com/2008/01/01/find-objects-in-irb-directly-from-browser-urls/#comment-70465</guid>
		<description>Ooh, I forgot the hook! You&#039;ll need to add the following to the bottom of your .irbrc file:

&lt;pre&gt;
IRB.conf[:IRB_RC] = Proc.new { define_model_find_shortcuts }
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Ooh, I forgot the hook! You&#8217;ll need to add the following to the bottom of your .irbrc file:</p>
<pre>
IRB.conf[:IRB_RC] = Proc.new { define_model_find_shortcuts }
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>

