<?xml version="1.0" encoding="UTF-8"?>
<posts type="array">
  <post>
    <body>&lt;p&gt;Today I&amp;#8217;ve been captivated by an article published in the New Yorker by food writer and Chinese cuisine specialist Fuschia Dunlop. &lt;a href="http://www.newyorker.com/reporting/2008/11/24/081124fa_fact_dunlop?currentPage=all"&gt;Letters from China: Garden of Contentment&lt;/a&gt; is the story of Dragon Well Manor, a restaurant in Hangzhou that strives to keep alive ancient cuisinary techniques of the region, sourcing ingredients not just from local farms and collectors, but from expeditions through the forests and mountains of the region as well.&lt;/p&gt;


	&lt;p&gt;Just as captivating are the descriptions of the restaurant, which was originally a traditional landscaped garden in one of China&amp;#8217;s most spectacular natural regions.&lt;/p&gt;</body>
    <created-at type="datetime">2008-11-28T17:01:58+00:00</created-at>
    <id type="integer">52</id>
    <permalink>garden-of-contentment</permalink>
    <title>Garden of Contentment</title>
    <updated-at type="datetime">2008-11-29T01:02:15+00:00</updated-at>
  </post>
  <post>
    <body>&lt;p&gt;Earlier today I &lt;a href="http://jamesgolick.com/2008/10/27/off-topic-caf&#233;-myriade"&gt;came across mention&lt;/a&gt; of a new espresso place in Downtown Montreal called Cafe Myriade. Oddly enough, it was on another developer&amp;#8217;s blog, &lt;a href="http://jamesgolick.com/"&gt;James Golick,&lt;/a&gt; who&amp;#8217;s even more of a coffee nerd than me, it seems.&lt;/p&gt;


	&lt;p&gt;The staff at Myriade is genuinely friendly and excited about their new venture. The espresso I ordered &amp;#8211; a single shot made with coffee from Vancouver&amp;#8217;s &lt;a href="http://www.49thparallelroasters.com/"&gt;49th Parallel&lt;/a&gt; &amp;#8211; was among the best I&amp;#8217;ve had in recent memory, incredibly velvety, with as little bitterness as I&amp;#8217;ve had with these beans. Remarkably even and enjoyable, especially if you like woody/chocolatey espresso.&lt;/p&gt;


	&lt;p&gt;Myriade also sells &lt;a href="http://somachocolate.com/"&gt;&lt;span class="caps"&gt;SOMA&lt;/span&gt;&lt;/a&gt; chocolate, imported from the Toronto chocolatier, one of only two in Canada that make their own chocolate, apparently. I really like that this shop is supporting Canadian providers, and at really reasonable prices ($2 for a single shot of espresso, for instance). Apparently the lattes and melted chocolate cappuccinos are Myriade&#8217;s specialty.&lt;/p&gt;


	&lt;p&gt;So check it out: &lt;a href="http://cafemyriade.com"&gt;Cafe Myriade&lt;/a&gt; located at 1432 Mackay, Downtown Montreal, between Ste-Catherine and DeMaisonneueve.&lt;/p&gt;</body>
    <created-at type="datetime">2008-11-06T00:16:53+00:00</created-at>
    <id type="integer">51</id>
    <permalink>cafe-myriade</permalink>
    <title>Cafe Myriade</title>
    <updated-at type="datetime">2008-11-17T18:25:09+00:00</updated-at>
  </post>
  <post>
    <body>&lt;p&gt;So I&amp;#8217;ve discovered the wonderfully easy-to-use &lt;a href="http://www.thoughtbot.com/projects/paperclip"&gt;Paperclip&lt;/a&gt; attachment plugin for Ruby on Rails, written by Jon Yurek at &lt;a href="http://www.thoughtbot.com"&gt;Thoughbot&lt;/a&gt; .&lt;/p&gt;


	&lt;p&gt;I like that attachments are treated like any other class instance attribute (@post.image), instead of having to be associated with a post from a separate assets resource entirely. It uses Imagemagick, it has a small footprint, many of the features that make attachment_fu great, and others that it lacks.&lt;/p&gt;


	&lt;p&gt;When I started playing around with Paperclip, I noticed that there are some RESTful actions missing in the documentation: destroy, edit, update, and so on. That same documention intimates that you should/can have an upload form on your edit page, so I persevered &#8211; it would really be ideal if users could simply upload new images and documents, overwriting existing ones.&lt;/p&gt;


	&lt;p&gt;When I got to this point, I did what anyone would do: wrote out the actions based on the generated scaffolding patterns, hoping it would &amp;#8216;just work&amp;#8217;. I had a post model with attachments for an image and also a sample text. Not only do I want users to be able to swap these out, but to update other columns in the class instance without losing the existing files attached to the record.&lt;/p&gt;


	&lt;p&gt;When I went ahead a tested the configuration I&amp;#8217;d cobbled together, it wasn&amp;#8217;t working correctly. It didn&amp;#8217;t update, it &lt;em&gt;created&lt;/em&gt; a new record, with the existing values, which was&amp;#8230;not ideal.&lt;/p&gt;


	&lt;p&gt;Evaluating the form_for tag, I noticed that the tag I&amp;#8217;d copied in from the RiDocs was using was a little unusual:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;&amp;lt;% form_for :post, @post, :url =&amp;gt; posts_path, :html =&amp;gt; { :multipart =&amp;gt; true } do |f| %&amp;gt;&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;The tutorials online only require the symbol for the class and the &lt;code&gt;multipart =&amp;gt; true&lt;/code&gt; bits. Not only that, but knowing how RESTful conventions work, that &lt;code&gt;:url =&amp;gt; posts_path&lt;/code&gt; is an obvious problem: when you&amp;#8217;re working with a class instance, your paths should be singular.&lt;/p&gt;


	&lt;p&gt;Changing it to singular (&lt;code&gt;:url =&amp;gt; post_path&lt;/code&gt;) didn&amp;#8217;t work &#8211; suddenly I was getting an error stating that the ID of the object wasn&amp;#8217;t an action! Well, obviously. So I needed to explicitly state the action:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;&amp;lt;% form_for :post, @post, :url =&amp;gt; post_path, :action =&amp;gt; 'update', :html =&amp;gt; { :multipart =&amp;gt; true} do |f| %&amp;gt;  &lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;But this didn&amp;#8217;t work either! The update parameter was either being overlooked or wasn&amp;#8217;t providing the correct parameters in the expected format. Finally, researching the available parameters for the form_for tag, I came up with this:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;&amp;lt;% form_for :post, @post, :url =&amp;gt; post_path, :html =&amp;gt; { :multipart =&amp;gt; true, :method =&amp;gt; :put } do |f| %&amp;gt;  &lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Which explicitly states the http method used in the transaction. This works beautifully! File attachments remain the same unless you&amp;#8217;ve selected new ones,  it works for multiple simultaneous attachments on a model&amp;#8230;it&amp;#8217;s gorgeous. I hope this helps, I couldn&amp;#8217;t find much info on edit/update features for Paperclip.&lt;/p&gt;</body>
    <created-at type="datetime">2008-08-29T00:37:23+00:00</created-at>
    <id type="integer">50</id>
    <permalink>edit-update-paperclip-plugin-attachments</permalink>
    <title>Edit/Update Paperclip Plugin Attachments</title>
    <updated-at type="datetime">2008-08-29T07:49:12+00:00</updated-at>
  </post>
  <post>
    <body>&lt;p&gt;&lt;img src="http://kevinfinlayson.com/images/assets/0000/0089/oly4.jpg" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.boston.com/bigpicture/"&gt;The Big Picture&lt;/a&gt; has posted yet another &lt;a href="http://www.boston.com/bigpicture/2008/08/2008_olympics_opening_ceremony.html"&gt;fantastic photo essay&lt;/a&gt; on the opening ceremonies of the Beijing 2008 Olympic Games.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;d really like to see some video of Cai Guo-Qiang&#8217;s fireworks and gunpowder show (of which I&amp;#8217;m assuming the above photo is a highlight).&lt;/p&gt;</body>
    <created-at type="datetime">2008-08-08T13:30:43+00:00</created-at>
    <id type="integer">49</id>
    <permalink>beijing-2008-opening-ceremony</permalink>
    <title>Beijing 2008 Opening Ceremony</title>
    <updated-at type="datetime">2008-08-08T20:31:19+00:00</updated-at>
  </post>
  <post>
    <body>&lt;p&gt;&lt;img src="http://kevinfinlayson.com/images/assets/0000/0087/Picture_1.png" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;Longtime Dust and Mold client Andrea Vanderkooij and her husband Alan Groombridge welcomed Kees Alfred Vanderkooij-Groombridge into their family on Sunday, June 30. Kees Alfred is a large, healthy and happy baby (9.5 lbs, 22.5 inches), possibly with an early taste for butter-cream icing, as a result of his mother&amp;#8217;s recent &lt;em&gt;Babycakes&lt;/em&gt; project and performance, which you can check out at &lt;a href="http://andreavanderkooij.com/works/per_bab.php"&gt;the artist&#8217;s website&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Congratulations Andrea and Alan!&lt;/p&gt;</body>
    <created-at type="datetime">2008-07-05T13:02:10+00:00</created-at>
    <id type="integer">48</id>
    <permalink>welcome-kees-alfred</permalink>
    <title>Welcome Kees Alfred</title>
    <updated-at type="datetime">2008-07-06T00:40:14+00:00</updated-at>
  </post>
</posts>
