<?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"
	>
<channel>
	<title>Comments on: friendly_id - Ruby on Rails plugin for human-readable id&#8217;s</title>
	<atom:link href="http://randomba.org/index.php/2008/01/18/friendly_id-ruby-on-rails-plugin-for-human-readable-ids/feed/" rel="self" type="application/rss+xml" />
	<link>http://randomba.org/index.php/2008/01/18/friendly_id-ruby-on-rails-plugin-for-human-readable-ids/</link>
	<description>Programming, Ruby, Rails, and other random things.</description>
	<pubDate>Sat, 05 Jul 2008 09:24:30 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Norman</title>
		<link>http://randomba.org/index.php/2008/01/18/friendly_id-ruby-on-rails-plugin-for-human-readable-ids/#comment-58</link>
		<dc:creator>Norman</dc:creator>
		<pubDate>Mon, 23 Jun 2008 19:33:37 +0000</pubDate>
		<guid isPermaLink="false">http://randomba.com/?p=23#comment-58</guid>
		<description>Thanks a lot for that, Robert. I'll try to get that integrated as soon as possible!</description>
		<content:encoded><![CDATA[<p>Thanks a lot for that, Robert. I&#8217;ll try to get that integrated as soon as possible!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Woodward</title>
		<link>http://randomba.org/index.php/2008/01/18/friendly_id-ruby-on-rails-plugin-for-human-readable-ids/#comment-57</link>
		<dc:creator>Robert Woodward</dc:creator>
		<pubDate>Mon, 23 Jun 2008 19:27:58 +0000</pubDate>
		<guid isPermaLink="false">http://randomba.com/?p=23#comment-57</guid>
		<description>Hey,

We ran into the problem of Eager Loading not workin on on the project I work on (http://www.feistypiranha.com) so we decided to fix it up.

I posted the solution that we came up with on our blog (http://www.feistypiranha.com/getting-friendly_id-to-work/).  I have only done limited testing with it, but in theory all parameters should work now...  So you can do :conditions =&#62; "1 = 2", and it will correctly fail (Not return any results.  Since, as far as I know, 1 != 2)

The method we changed was "find_using_friendly_id" in the SluggableClassMethods module.  (Line 127)
And the updated code goes as follows:

      # Finds the record using only the friendly id. If it can't be found
      # using the friendly id, then it returns false. If you pass in any
      # argument other than an instance of String, then it also returns false.
      def find_using_friendly_id(*args)
        return false unless args.first.kind_of?(String)
        slug = Slug.find_by_name_and_sluggable_type(args.first, self.to_s)
        begin
          # Get the class and pass our options
          object_class = Module.const_get(slug.sluggable_type)
          options = args.extract_options!
          return  object_class.find(slug.sluggable_id, options)
        rescue    # The class was bad, use the old slug way
          return false if !slug
          return false if !slug.sluggable
          slug.sluggable.send(:finder_slug=, slug)
          slug.sluggable
        end
      end

Take care everyone, hope this helps!
Robert</description>
		<content:encoded><![CDATA[<p>Hey,</p>
<p>We ran into the problem of Eager Loading not workin on on the project I work on (http://www.feistypiranha.com) so we decided to fix it up.</p>
<p>I posted the solution that we came up with on our blog (http://www.feistypiranha.com/getting-friendly_id-to-work/).  I have only done limited testing with it, but in theory all parameters should work now&#8230;  So you can do :conditions =&gt; &#8220;1 = 2&#8243;, and it will correctly fail (Not return any results.  Since, as far as I know, 1 != 2)</p>
<p>The method we changed was &#8220;find_using_friendly_id&#8221; in the SluggableClassMethods module.  (Line 127)<br />
And the updated code goes as follows:</p>
<p>      # Finds the record using only the friendly id. If it can&#8217;t be found<br />
      # using the friendly id, then it returns false. If you pass in any<br />
      # argument other than an instance of String, then it also returns false.<br />
      def find_using_friendly_id(*args)<br />
        return false unless args.first.kind_of?(String)<br />
        slug = Slug.find_by_name_and_sluggable_type(args.first, self.to_s)<br />
        begin<br />
          # Get the class and pass our options<br />
          object_class = Module.const_get(slug.sluggable_type)<br />
          options = args.extract_options!<br />
          return  object_class.find(slug.sluggable_id, options)<br />
        rescue    # The class was bad, use the old slug way<br />
          return false if !slug<br />
          return false if !slug.sluggable<br />
          slug.sluggable.send(:finder_slug=, slug)<br />
          slug.sluggable<br />
        end<br />
      end</p>
<p>Take care everyone, hope this helps!<br />
Robert</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Norman</title>
		<link>http://randomba.org/index.php/2008/01/18/friendly_id-ruby-on-rails-plugin-for-human-readable-ids/#comment-54</link>
		<dc:creator>Norman</dc:creator>
		<pubDate>Thu, 19 Jun 2008 10:09:02 +0000</pubDate>
		<guid isPermaLink="false">http://randomba.com/?p=23#comment-54</guid>
		<description>@Jim

You can use any method to generate the friendly id, it doesn't just have to be a column. So you coud do something like this:

has_friendly_id :title_and_username, :use_slug =&gt; true

def title_and_username
   "#{user.name}-#{title}"
end</description>
		<content:encoded><![CDATA[<p>@Jim</p>
<p>You can use any method to generate the friendly id, it doesn&#8217;t just have to be a column. So you coud do something like this:</p>
<p>has_friendly_id :title_and_username, :use_slug => true</p>
<p>def title_and_username<br />
   &#8220;#{user.name}-#{title}&#8221;<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Norman</title>
		<link>http://randomba.org/index.php/2008/01/18/friendly_id-ruby-on-rails-plugin-for-human-readable-ids/#comment-53</link>
		<dc:creator>Norman</dc:creator>
		<pubDate>Thu, 19 Jun 2008 10:05:05 +0000</pubDate>
		<guid isPermaLink="false">http://randomba.com/?p=23#comment-53</guid>
		<description>@Keith Pitty

I'll look into this. If you want, send me an email to norman@randomba.org and give me some more specifics on what fails; I'll work on a fix.</description>
		<content:encoded><![CDATA[<p>@Keith Pitty</p>
<p>I&#8217;ll look into this. If you want, send me an email to <a href="mailto:norman@randomba.org">norman@randomba.org</a> and give me some more specifics on what fails; I&#8217;ll work on a fix.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Norman</title>
		<link>http://randomba.org/index.php/2008/01/18/friendly_id-ruby-on-rails-plugin-for-human-readable-ids/#comment-52</link>
		<dc:creator>Norman</dc:creator>
		<pubDate>Thu, 19 Jun 2008 10:03:03 +0000</pubDate>
		<guid isPermaLink="false">http://randomba.com/?p=23#comment-52</guid>
		<description>@c.y. 

Try using slugs.

But I'll look into adding better support for "slugless" mode, you're not the first person to ask about this.</description>
		<content:encoded><![CDATA[<p>@c.y. </p>
<p>Try using slugs.</p>
<p>But I&#8217;ll look into adding better support for &#8220;slugless&#8221; mode, you&#8217;re not the first person to ask about this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith Pitty</title>
		<link>http://randomba.org/index.php/2008/01/18/friendly_id-ruby-on-rails-plugin-for-human-readable-ids/#comment-51</link>
		<dc:creator>Keith Pitty</dc:creator>
		<pubDate>Mon, 16 Jun 2008 03:17:58 +0000</pubDate>
		<guid isPermaLink="false">http://randomba.com/?p=23#comment-51</guid>
		<description>Thanks for the plugin but I couldn't get it to work with models that use STI.</description>
		<content:encoded><![CDATA[<p>Thanks for the plugin but I couldn&#8217;t get it to work with models that use STI.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark&#8217;s Link Blog &#187; links for 2008-06-15</title>
		<link>http://randomba.org/index.php/2008/01/18/friendly_id-ruby-on-rails-plugin-for-human-readable-ids/#comment-50</link>
		<dc:creator>Mark&#8217;s Link Blog &#187; links for 2008-06-15</dc:creator>
		<pubDate>Sun, 15 Jun 2008 06:31:21 +0000</pubDate>
		<guid isPermaLink="false">http://randomba.com/?p=23#comment-50</guid>
		<description>[...] friendly_id - Ruby on Rails plugin for human-readable id’s &#124; randomba (tags: rubyonrails plugin url) [...]</description>
		<content:encoded><![CDATA[<p>[...] friendly_id - Ruby on Rails plugin for human-readable id’s | randomba (tags: rubyonrails plugin url) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim</title>
		<link>http://randomba.org/index.php/2008/01/18/friendly_id-ruby-on-rails-plugin-for-human-readable-ids/#comment-48</link>
		<dc:creator>Jim</dc:creator>
		<pubDate>Fri, 06 Jun 2008 21:10:37 +0000</pubDate>
		<guid isPermaLink="false">http://randomba.com/?p=23#comment-48</guid>
		<description>Is it possible to append anything to the title in the URL?  In my case, I'd like to add the username to the post titles in the URL to make the URLs for unique and less chance of having to increment the title.

e.g. http:www.website.com/post/joe_This_is_a_title where "joe" is the user that created the post.  Of course, I don't want the username actually prepended to the post title in my posts table.</description>
		<content:encoded><![CDATA[<p>Is it possible to append anything to the title in the URL?  In my case, I&#8217;d like to add the username to the post titles in the URL to make the URLs for unique and less chance of having to increment the title.</p>
<p>e.g. http:www.website.com/post/joe_This_is_a_title where &#8220;joe&#8221; is the user that created the post.  Of course, I don&#8217;t want the username actually prepended to the post title in my posts table.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: c.y.</title>
		<link>http://randomba.org/index.php/2008/01/18/friendly_id-ruby-on-rails-plugin-for-human-readable-ids/#comment-47</link>
		<dc:creator>c.y.</dc:creator>
		<pubDate>Fri, 06 Jun 2008 04:57:29 +0000</pubDate>
		<guid isPermaLink="false">http://randomba.com/?p=23#comment-47</guid>
		<description>If I base the friendly url on my title "first day in London" it gets turned into first+day+in+London instead of first-day-in-London. Is there a way to fix this?

Thanks in advance.</description>
		<content:encoded><![CDATA[<p>If I base the friendly url on my title &#8220;first day in London&#8221; it gets turned into first+day+in+London instead of first-day-in-London. Is there a way to fix this?</p>
<p>Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Norman</title>
		<link>http://randomba.org/index.php/2008/01/18/friendly_id-ruby-on-rails-plugin-for-human-readable-ids/#comment-46</link>
		<dc:creator>Norman</dc:creator>
		<pubDate>Mon, 19 May 2008 21:40:54 +0000</pubDate>
		<guid isPermaLink="false">http://randomba.com/?p=23#comment-46</guid>
		<description>Sorry about that, svn is now back online.

I'll keep svn up until Rails 2.1 has been out for a few months. At that point I'll stop supporting svn unless I hear from a lot of people who still need it.</description>
		<content:encoded><![CDATA[<p>Sorry about that, svn is now back online.</p>
<p>I&#8217;ll keep svn up until Rails 2.1 has been out for a few months. At that point I&#8217;ll stop supporting svn unless I hear from a lot of people who still need it.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
