<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Robu on Ruby</title>
    <link>http://ruby.robu.se/</link>
    <description>Robert Bur&#233;n on his Ruby excursions</description>
    <language>en-us</language>
    <item>
      <title>Sidebar beta</title>
      <description>&lt;p&gt;I&amp;#8217;ve finally crossed off one more feature on the list: a configurable sidebar. I&amp;#8217;ve created three types of items to include in the sidebar:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Any static &lt;span class="caps"&gt;HTML&lt;/span&gt;&lt;/li&gt;
	&lt;li&gt;Most used tags&lt;/li&gt;
	&lt;li&gt;Latest comments&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;However, it&amp;#8217;s all very much in a beta stage at the moment&amp;#8230; The only way to add items is using the &lt;a href="http://wiki.rubyonrails.org/rails/pages/Console"&gt;Rails Console&lt;/a&gt;, which may not be considered a &amp;#8220;best practice&amp;#8221;. Also, both the &amp;#8220;Most used tags&amp;#8221; and the &amp;#8220;latest comments&amp;#8221; component displays only unlinked text. Obviously some more work is needed here as well.&lt;/p&gt;
&lt;p&gt;Oh, as for the image in this entry: it&amp;#8217;s supposedly a &amp;#8220;side bar&amp;#8221;&amp;#8230;&lt;/p&gt;</description>
      <author>Robert Bur&#233;n</author>
      <pubDate>Sun, 14 Sep 2008 07:16:00 +0000</pubDate>
      <link>http://ruby.robu.se/posts/16-sidebar-beta</link>
      <guid>http://ruby.robu.se/posts/16-sidebar-beta</guid>
    </item>
    <item>
      <title>IE layout fixed. I hope...</title>
      <description>&lt;p&gt;I think I&amp;#8217;ve fixed the Internet Explorer layout issues for now. At least it looks ok for me. How this site looks like in IE won&amp;#8217;t be the highest priority for me, but I still definitely appreciate any comments on issues that you might see.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m not dissing IE, it&amp;#8217;s just that I have now finally converted all my main computers on to Ubuntu, so that&amp;#8217;s all I see on a daily basis. This screenshot was taken on &lt;a href="http://www.howtoforge.com/how-to-install-internet-explorer-on-ubuntu8.04"&gt;IE6 on Ubuntu&lt;/a&gt;, by the way&amp;#8230;&lt;/p&gt;</description>
      <author>Robert Bur&#233;n</author>
      <pubDate>Thu, 11 Sep 2008 14:05:00 +0000</pubDate>
      <link>http://ruby.robu.se/posts/15-ie-layout-fixed-i-hope</link>
      <guid>http://ruby.robu.se/posts/15-ie-layout-fixed-i-hope</guid>
    </item>
    <item>
      <title>IE is not my friend</title>
      <description>&lt;p&gt;It has come to my attention (with the help of the brilliantly useful service provided by &lt;a href="http://browsershots.org"&gt;Browsershots.org&lt;/a&gt;) that this blog layout doesn&amp;#8217;t look good in Internet Explorer (version 7 on Windows).&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ve also been led to believe that there are people out there that actually use IE as their main browser. Strange as that may seem, I will try to fix the appearance issues for IE users as soon as possible!&lt;/p&gt;
&lt;p&gt;(Oh, and any help or pointer to what the root source of the problem actually &lt;em&gt;is&lt;/em&gt; will be much appreciated!)&lt;/p&gt;</description>
      <author>Robert Bur&#233;n</author>
      <pubDate>Tue, 02 Sep 2008 20:03:00 +0000</pubDate>
      <link>http://ruby.robu.se/posts/14-ie-is-not-my-friend</link>
      <guid>http://ruby.robu.se/posts/14-ie-is-not-my-friend</guid>
    </item>
    <item>
      <title>Ubuntu vs Rails</title>
      <description>&lt;p&gt;I don&amp;#8217;t know what happened! I had a perfect little setup on my &lt;span class="caps"&gt;VPS&lt;/span&gt;, with a super simple script to install all the little packages I wanted, including ruby, rubygems, git and &lt;a href="http://www.modrails.com/"&gt;Passenger&lt;/a&gt;. It goes something like this:&lt;/p&gt;
&lt;pre name="code" class="bash"&gt;
# Some non-ruby installs first...

# Ruby
apt-get -qq -y install ruby-full libmysql-ruby rubygems
gem update --system

# Version control
apt-get -qq -y install git-core subversion cvs

# Passenger (aka mod_rails). This will also include apache2
# Need to add the brightbox gpg key before installing
echo "deb http://apt.brightbox.net hardy main" &amp;gt;&amp;gt; /etc/apt/sources.list
wget http://apt.brightbox.net/release.asc -O - | apt-key add -
apt-get -qq update
apt-get -qq -y install libapache2-mod-passenger
&lt;/pre&gt;
&lt;p&gt;The wget and apt-key parts is to get the gpg key from brightbox. If you don&amp;#8217;t, you&amp;#8217;ll end up with annoying warnings everytime you do an &amp;#8220;&lt;code&gt;apt-get whatever&lt;/code&gt;&amp;#8221;.&lt;/p&gt;
&lt;p&gt;Anyway &amp;#8212; that setup worked perfectly! Until about a week ago, that is&amp;#8230;&lt;/p&gt;
&lt;p&gt;Now, when I check what there is to update, with the usual commands&amp;#8230;&lt;/p&gt;
&lt;pre class="bash:nocontrols" name="code"&gt;
apt-get update
apt-get -s dist-upgrade
&lt;/pre&gt;
&lt;p&gt;&amp;#8230;I get into problems. For some reason, apt-get wants to &lt;em&gt;remove&lt;/em&gt; passenger. Now, why is that?&lt;/p&gt;
&lt;p&gt;The printout reads as follows:&lt;/p&gt;
&lt;pre name="code" class="bash:nocontrols"&gt;
The following packages will be REMOVED:
  libapache2-mod-passenger libgems-ruby1.8
The following NEW packages will be installed:
  rubygems1.8
The following packages will be upgraded:
  initramfs-tools iproute irb libdbm-ruby libgdbm-ruby libopenssl-ruby libreadline-ruby pciutils rdoc ri ruby ruby-full rubygems tzdata
&lt;/pre&gt;
&lt;p&gt;Someone &lt;strong&gt;please&lt;/strong&gt; tell me how to get back on track again! Or back on the Rails, as it were&amp;#8230;&lt;/p&gt;</description>
      <author>Robert Bur&#233;n</author>
      <pubDate>Thu, 21 Aug 2008 05:53:00 +0000</pubDate>
      <link>http://ruby.robu.se/posts/13-ubuntu-vs-rails</link>
      <guid>http://ruby.robu.se/posts/13-ubuntu-vs-rails</guid>
    </item>
    <item>
      <title>Back to the Future</title>
      <description>&lt;p&gt;(Yeah I know &amp;#8212; the title of this post is embarrassing!)&lt;/p&gt;
&lt;p&gt;Yesterday I posted a kind of &lt;a href="http://ruby.robu.se/posts/11-its-that-status-time-again"&gt;status report&lt;/a&gt;, so I guess now is a good time to follow up with a sketchy roadmap for the next few weeks (or maybe, months).&lt;/p&gt;
&lt;p&gt;Features I want to add next to blog.rb are (in no particular order):&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;A sidebar&amp;#8230; Of course, this is just a layout element, but I want to make a modular sidebar that I can configure the contents of&lt;/li&gt;
	&lt;li&gt;Static pages. Even a blog needs a few static pages: a blog author profile maybe, and stuff like that. These should really be handled the same way as ordinary posts, but probably have a different &lt;span class="caps"&gt;URL&lt;/span&gt; and not show up among the other posts.&lt;/li&gt;
	&lt;li&gt;Full text search. Ideally, the same search will look in posts, tags, and static pages.&lt;/li&gt;
	&lt;li&gt;Automatic &lt;a href="http://en.wikipedia.org/wiki/Ping_blog"&gt;blog ping&lt;/a&gt; via &lt;a href="http://technorati.com/developers/ping/"&gt;&lt;span class="caps"&gt;XML&lt;/span&gt;-&lt;span class="caps"&gt;RPC&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;Category list in sidebar. This is probably just a tag cloud like feature, but since I think I really dislike tag clouds it&amp;#8217;ll probably look more list-like.&lt;/li&gt;
	&lt;li&gt;A link to blog.rb&amp;#8217;s home on GitHub. I feel like I need to take some time cleaning up docs in the project before I publish the link. The link is there for anyone to find anyway, but it&amp;#8217;s more official if I link to it from here&amp;#8230;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After all of the above: who knows? Maybe it&amp;#8217;s time I put some energy in a real project instead of this toy&amp;#8230; We&amp;#8217;ll see.&lt;/p&gt;</description>
      <author>Robert Bur&#233;n</author>
      <pubDate>Sun, 03 Aug 2008 08:24:00 +0000</pubDate>
      <link>http://ruby.robu.se/posts/12-back-to-the-future</link>
      <guid>http://ruby.robu.se/posts/12-back-to-the-future</guid>
    </item>
    <item>
      <title>It's that status time again</title>
      <description>&lt;p&gt;So, where are we?&lt;/p&gt;
&lt;p&gt;Three weeks ago, and just after starting this blog, I posted a &lt;a href="http://ruby.robu.se/posts/2-status-report"&gt;status report&lt;/a&gt;. Later the same day, I posted a &lt;a href="http://ruby.robu.se/posts/3-the-future"&gt;roadmap&lt;/a&gt; for the near future. I think it&amp;#8217;s fair to say that I can now check all the items on that list. I think I have commented on most (all?) of them on previous posts, but let&amp;#8217;s not let that keep us from going through the list again:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://ruby.robu.se/posts/6-feed-enabled"&gt;&lt;span class="caps"&gt;RSS&lt;/span&gt; feeds&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://ruby.robu.se/posts/8-comments-one"&gt;Comments&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://ruby.robu.se/posts/10-attached-images"&gt;Uploadable images&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://ruby.robu.se/posts/9-tags-introduced"&gt;Tags and/or categories&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://ruby.robu.se/posts/7-paginating"&gt;Pagination&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://ruby.robu.se/posts/5-url-cleanup"&gt;Nicer URLs&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Cleanup of some views&lt;/strong&gt; &amp;#8212; Hmm, this doesn&amp;#8217;t have a post of its own, and I&amp;#8217;m certainly not completely done with this item. On the other hand I&amp;#8217;ve come to realize that it&amp;#8217;s an ongoing task anyway. I guess I need to be more specific on my roadmaps in the future&amp;#8230;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Stay tuned to see what comes next, this time&amp;#8230;&lt;/p&gt;</description>
      <author>Robert Bur&#233;n</author>
      <pubDate>Sat, 02 Aug 2008 19:25:00 +0000</pubDate>
      <link>http://ruby.robu.se/posts/11-its-that-status-time-again</link>
      <guid>http://ruby.robu.se/posts/11-its-that-status-time-again</guid>
    </item>
    <item>
      <title>Attached images</title>
      <description>&lt;p&gt;Dear Diary,&lt;/p&gt;
&lt;p&gt;Today I added an image upload plugin called &lt;a href="http://github.com/technoweenie/attachment_fu/tree/master"&gt;attachment_fu&lt;/a&gt;. It worked great! The only thing that wasn&amp;#8217;t provided for me out-of-the-box was the ability to show an image stored in the database.&lt;/p&gt;
&lt;p&gt;The remedy for this was a new controller (actually, another sub-resource to posts), with the following method:&lt;/p&gt;
&lt;pre class="ruby:nocontrols" name="code"&gt;
  def show
    @content_image = @post.content_images.find(params[:id])
    headers['Content-Length'] = @content_image.size
    send_data @content_image.db_file.data, 
      :type =&amp;gt; @content_image.content_type, 
      :disposition =&amp;gt; 'inline', 
      :filename =&amp;gt; @content_image.filename
  end
&lt;/pre&gt;
&lt;p&gt;I&amp;#8217;d like to point out one &lt;em&gt;gotcha&lt;/em&gt; to be picked up by search engines: the &lt;span class="caps"&gt;README&lt;/span&gt; for attachment_fu simply says that you should create a migration for a model called DbFile with a field :data of type :binary. The problem is that the default for MySQL is to use the &lt;span class="caps"&gt;BLOB&lt;/span&gt; type, which has a limit of 64k. You need to use a larger database type, such as &lt;span class="caps"&gt;MEDIUMBLOB&lt;/span&gt; or &lt;span class="caps"&gt;LONGBLOB&lt;/span&gt;. This is accomplished by adding a :limit parameter to the migration:&lt;/p&gt;
&lt;pre name="code" class="ruby:nocontrols"&gt;
    create_table :db_files do |t|
      t.binary :data, :limit =&amp;gt; 10.megabytes # here it is
      t.timestamps
    end
&lt;/pre&gt;
&lt;p&gt;Setting a larger :limit like that will cause a larger database type to be used.&lt;/p&gt;
&lt;p&gt;Now, the current implementation of attaching an image to a post is really limited. If there is an image, it is shown at the top of the post, right-aligned. That&amp;#8217;s it. No checking for dimensions, alt texts or anything like that. Also no way to tag where in the post the image should be displayed. This will (probably&amp;#8230;?) be fixed in future versions!&lt;/p&gt;</description>
      <author>Robert Bur&#233;n</author>
      <pubDate>Sat, 02 Aug 2008 12:06:00 +0000</pubDate>
      <link>http://ruby.robu.se/posts/10-attached-images</link>
      <guid>http://ruby.robu.se/posts/10-attached-images</guid>
    </item>
    <item>
      <title>Tags introduced</title>
      <description>&lt;p&gt;Next feature to cross off the &lt;span class="caps"&gt;TODO&lt;/span&gt;-list for blog.rb: tags. It&amp;#8217;s now possible to tag posts in the conventional Web 2.0 way. Tags are displayed on top of each post, as links. Click on a tag and You&amp;#8217;ll see a list (fetched with Ajax, no less) of posts using that tag.&lt;/p&gt;
&lt;p&gt;To get that tag goodness, I&amp;#8217;m using the &lt;a href="http://www.intridea.com/2008/6/9/acts-as-taggable-on-grows-up"&gt;acts_as_taggable_on&lt;/a&gt; plugin, which I really recommend! Integrating the plugin in blog.rb was as easy as 1-2-3:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Run &lt;code&gt;./script/generate acts_as_taggable_on_migration&lt;/code&gt; to create a migration with the tags and taggings tables. Run the migration (&lt;code&gt;rake db:migrate&lt;/code&gt; as usual).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; Add this line to the Post class:&lt;/p&gt;
&lt;pre name="code" class="ruby:nocontrols"&gt;
  acts_as_taggable_on :tags
&lt;/pre&gt;
&lt;p&gt;The &amp;#8220;:tags&amp;#8221; parameter is the name of the tag field in the model. We could have chosen to call it something else, ie &amp;#8220;categories&amp;#8221;, &amp;#8220;keywords&amp;#8221;, &amp;#8220;topics&amp;#8221;, etc, but I&amp;#8217;m sticking with &amp;#8220;tags&amp;#8221; for now.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; Next we add a field for the tags in the &amp;#8220;create post&amp;#8221; form:&lt;/p&gt;
&lt;pre name="code" class="html:nocontrols"&gt;
  &amp;lt;p&amp;gt;
    &amp;lt;%= f.label :tag_list, "Tags" %&amp;gt;&amp;lt;br /&amp;gt;
    &amp;lt;%= f.text_field :tag_list %&amp;gt;
  &amp;lt;/p&amp;gt;
&lt;/pre&gt;
&lt;p&gt;That&amp;#8217;s it for adding it to the model. Of course, we also want to show the tags in a nice way, and make them useful to readers. This is where The Ajax comes in.&lt;/p&gt;
&lt;p&gt;If a post has tags, I display them comma-separated below the title of the post. Each tag in that line is rendered like this:&lt;/p&gt;
&lt;pre name="code" class="ruby:nocontrols"&gt;
  link_to_remote tag.name,
    :url =&amp;gt; {:controller =&amp;gt; :tags, :action =&amp;gt; :show, :id =&amp;gt; tag, :blog_id =&amp;gt; post.blog, :post_id =&amp;gt; post, :show_title =&amp;gt; true},
    :method =&amp;gt; :get,
    :update =&amp;gt; "post_#{ post.id }_taginfo",
    :loading =&amp;gt; update_page {|page| page.visual_effect(:fade, "post_#{ post.id }_taginfo", :duration =&amp;gt; 0.2)},
    :complete =&amp;gt; update_page {|page| page.visual_effect(:appear, "post_#{ post.id }_taginfo", :duration =&amp;gt; 0.2)}
&lt;/pre&gt;
&lt;p&gt;In the code above, I&amp;#8217;m making an ajax call to the standard /tags/{id} &lt;span class="caps"&gt;REST&lt;/span&gt; url. I&amp;#8217;m not sure if that&amp;#8217;s really kosher, but hey &amp;#8212; it&amp;#8217;s my app! The result will render a list of linked posts that have that particular tag. Try it out!&lt;/p&gt;
&lt;p&gt;Now I&amp;#8217;m going to go back and tag all my previous posts! Fun, fun, fun!&lt;/p&gt;</description>
      <author>Robert Bur&#233;n</author>
      <pubDate>Mon, 28 Jul 2008 19:00:00 +0000</pubDate>
      <link>http://ruby.robu.se/posts/9-tags-introduced</link>
      <guid>http://ruby.robu.se/posts/9-tags-introduced</guid>
    </item>
    <item>
      <title>Comments: One</title>
      <description>&lt;p&gt;We have comments!&lt;/p&gt;
&lt;p&gt;Well, I have &lt;em&gt;one&lt;/em&gt; comment, which is the one I just added myself, to test the new comment feature on blog.rb. It is actually working, including &lt;a href="http://recaptcha.net"&gt;reCAPTCHA&lt;/a&gt; integration. Very nice.&lt;/p&gt;
&lt;p&gt;There are definitely more work to do on comments, so feel free to restrain yourself from actually using that feature for the time being&amp;#8230;&lt;/p&gt;
&lt;p&gt;Let&amp;#8217;s look at some code, instead. That&amp;#8217;s where the fun is, after all!&lt;/p&gt;
&lt;p&gt;Nested resources is a new thing for me. I have been aware of the concept since Rails went the &lt;span class="caps"&gt;REST&lt;/span&gt; way, but I haven&amp;#8217;t actually tried it. Turns out, it was really easy&amp;#8230;&lt;/p&gt;
&lt;p&gt;I wanted to nest the Comment resource as a sub resource to Post. This makes the URLs look like &amp;#8220;/posts/7/comments/14&amp;#8221;, which is referring to the comment with id 14 belonging to the post with id 7. Fairly intuitive. (Not that it matters in the slightest &amp;#8212; I don&amp;#8217;t even expect to show the &lt;span class="caps"&gt;URL&lt;/span&gt; for individual comments anywhere, but there you go&amp;#8230;)&lt;/p&gt;
&lt;p&gt;First step is to define the routing. This was as easy as adding a parameter to the existing route for posts:&lt;/p&gt;
&lt;pre name="code" class="ruby:nocontrols"&gt;
  map.resources :posts, :has_many =&amp;gt; :comments
&lt;/pre&gt;
&lt;p&gt;Next, I want to use the fact that the Post is known for all actions in the controller (since it is implied in the URL). Therefore, I add a &amp;#8220;before filter&amp;#8221; that gets the Post instance and saves it in an instance variable (@post) for later use in the action methods:&lt;/p&gt;
&lt;pre name="code" class="ruby:nocontrols"&gt;
class CommentsController &amp;lt; ApplicationController
  before_filter :load_post

  # all the action methods here...

  protected
  def load_post
    @post = Post.find(params[:post_id])
  end
end
&lt;/pre&gt;
&lt;p&gt;Finally, we must remember to specify the post as well as the comment for all helper methods for comment. For example, instead of a method &lt;code&gt;comment_path(@comment)&lt;/code&gt; like we would have for a non-nested resource, we use: &lt;code&gt;post_comment_path(@post, @comment)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;One other thing: I wanted to have the whole comments thing ajax based. This is almost trivial in Rails. Form handling consists of using the helper &lt;code&gt;remote_form_for()&lt;/code&gt; instead of the conventional &lt;code&gt;form_for()&lt;/code&gt;&amp;#8230;&lt;/p&gt;
&lt;p&gt;Handling the ajax response is more fun! I decided to try &lt;a href="http://www.rubyinside.com/16-rjs-resources-and-tutorials-for-rails-programmers-5.html"&gt;&lt;span class="caps"&gt;RJS&lt;/span&gt;&lt;/a&gt; since that was another piece of technology I hadn&amp;#8217;t used yet. &lt;span class="caps"&gt;RJS&lt;/span&gt; means that we can write simple Javascript code in pure Ruby. I.e. we write Ruby and Javascript is generated.&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;RJS&lt;/span&gt; can be used both on the client side (in views) and on the server (in controllers). When using it in controllers, Javascript is generated as response to a request (most likely an ajax request) and then run on the client.&lt;/p&gt;
&lt;pre name="code" class="ruby:nocontrols"&gt;
  def create
    @comment = Comment.new(params[:comment])
    @comment.post = @post
    
    if validate_recap(params, @comment.errors) &amp;amp;&amp;amp; @comment.save
      render :update do |page|
        page[:comment_form].visual_effect :fade, :duration =&amp;gt; 0.3
        page.insert_html :bottom, "comments", :partial =&amp;gt; "comment", :locals =&amp;gt; {:comment =&amp;gt; @comment}
        page.replace_html "comments_count_info", :partial =&amp;gt; "posts/comments_count_info", :locals =&amp;gt; {:comments =&amp;gt; @post.comments}
        page[:comments_count_info].visual_effect :highlight, :duration =&amp;gt; 4.0
        page["comment_#{@comment.id}".to_sym].scroll_to
        page["comment_#{@comment.id}".to_sym].visual_effect :highlight, :duration =&amp;gt; 4.0
        page[:form_hide_link].hide
        page[:form_show_link].show
      end
    else
      @comment.errors.add_to_base "Unable to save comment. Please try again later."
      render :update do |page|
        page.replace_html "form_errors", @comment.errors.full_messages.join("&amp;lt;br/&amp;gt;")
      end
    end
  end
&lt;/pre&gt;
&lt;p&gt;What&amp;#8217;s interesting with this technique is that I can update several elements on the page just with a few lines of Ruby code on the server. What I&amp;#8217;m not totally convinced about yet is that if it&amp;#8217;s a good thing to be able to do or not&amp;#8230; It very tempting to trigger visual effects and similar things that feels wrong to do on the server. Not for the &lt;span class="caps"&gt;MVC&lt;/span&gt; purists, so to speak. (As you see in the code above, I&amp;#8217;m not a purist. Also, this was my first foray to the &lt;span class="caps"&gt;RJS&lt;/span&gt; world and hopefully it&amp;#8217;s more obvious to me how it should be used optimally in the future.)&lt;/p&gt;</description>
      <author>Robert Bur&#233;n</author>
      <pubDate>Tue, 22 Jul 2008 19:10:00 +0000</pubDate>
      <link>http://ruby.robu.se/posts/8-comments-one</link>
      <guid>http://ruby.robu.se/posts/8-comments-one</guid>
    </item>
    <item>
      <title>Paginating</title>
      <description>&lt;p&gt;Ok, Pagination has been in place a few days now, but since I have it set to display ten posts per page, it&amp;#8217;ll be a while before it is apparent on this page.&lt;/p&gt;
&lt;p&gt;Adding it was simple: installing the &lt;a href="http://github.com/mislav/will_paginate/tree/master"&gt;will_paginate&lt;/a&gt; gem and adding this line of code in Blog#show:&lt;/p&gt;
&lt;pre name="code" class="ruby:nocontrols"&gt;
    @posts = @blog.published_posts.paginate :page =&amp;gt; params[:page], 
    :per_page =&amp;gt; 10
&lt;/pre&gt;
&lt;p&gt;Finally, one line in the view adds the actual pagination UI, if needed:&lt;/p&gt;
&lt;pre name="code" class="ruby:nocontrols"&gt;
&amp;lt;%= will_paginate @posts %&amp;gt;
&lt;/pre&gt;</description>
      <author>Robert Bur&#233;n</author>
      <pubDate>Sat, 19 Jul 2008 08:17:00 +0000</pubDate>
      <link>http://ruby.robu.se/posts/7-paginating</link>
      <guid>http://ruby.robu.se/posts/7-paginating</guid>
    </item>
  </channel>
</rss>

