<?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>Merbist &#187; router</title>
	<atom:link href="http://merbist.com/tag/router/feed/" rel="self" type="application/rss+xml" />
	<link>http://merbist.com</link>
	<description>Random thoughts of a software developer</description>
	<lastBuildDate>Tue, 03 Jan 2012 02:34:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>problems with urls in Merb HEAD?</title>
		<link>http://merbist.com/2008/09/30/problems-with-urls-in-merb-head/</link>
		<comments>http://merbist.com/2008/09/30/problems-with-urls-in-merb-head/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 06:24:29 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[merb]]></category>
		<category><![CDATA[merb-assets]]></category>
		<category><![CDATA[router]]></category>

		<guid isPermaLink="false">http://merbist.com/?p=101</guid>
		<description><![CDATA[I actually run into a small problem when updated an older Merb app. Here was how my router looked like: Merb::Router.prepare do &#124;r&#124; r.resources :channels do &#124;channels&#124; channels.resources :shows do &#124;shows&#124; shows.resources :episodes end end end But after updating to the latest version of Merb, I got links looking like: http://localhost:4000/channels/#&#60;Channel:0x27b7300&#62;/shows The first thing to [...]]]></description>
			<content:encoded><![CDATA[<p>I actually run into a small problem when updated an older Merb app. Here was how my router looked like:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#6666ff; font-weight:bold;">Merb::Router</span>.<span style="color:#9900CC;">prepare</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>r<span style="color:#006600; font-weight:bold;">|</span>
  r.<span style="color:#9900CC;">resources</span> <span style="color:#ff3333; font-weight:bold;">:channels</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>channels<span style="color:#006600; font-weight:bold;">|</span>
    channels.<span style="color:#9900CC;">resources</span> <span style="color:#ff3333; font-weight:bold;">:shows</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>shows<span style="color:#006600; font-weight:bold;">|</span>
      shows.<span style="color:#9900CC;">resources</span> <span style="color:#ff3333; font-weight:bold;">:episodes</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>But after updating to the latest version of Merb, I got links looking like:</p>
<pre>http://localhost:4000/channels/#&lt;Channel:0x27b7300&gt;/shows</pre>
<p>The first thing to do is to read <a title="new router" href="http://github.com/carllerche/merb-core-enterprise-edition/wikis/whats-new-with-the-router" target="_blank">Carl&#8217;s wiki about the latest Router changes</a>.</p>
<p>Carl explains that things got cleaned up in the router code and my routes should now look like:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#6666ff; font-weight:bold;">Merb::Router</span>.<span style="color:#9900CC;">prepare</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>r<span style="color:#006600; font-weight:bold;">|</span>
  r.<span style="color:#9900CC;">resources</span> <span style="color:#ff3333; font-weight:bold;">:channels</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    resources <span style="color:#ff3333; font-weight:bold;">:shows</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>shows<span style="color:#006600; font-weight:bold;">|</span>
      resources <span style="color:#ff3333; font-weight:bold;">:episodes</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>However that won&#8217;t be enough..  You see my url used to look like that:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">url<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:channel_shows</span>, <span style="color:#ff3333; font-weight:bold;">:channel_id</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; channel<span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>Now I can simplify it to:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">url<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:channel_shows</span>, channel<span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>That still won&#8217;t fix the problem, since the real problem comes from the fact that I was on Merb HEAD but not DataMapper HEAD. Updating DM clears things up. That&#8217;s the price to pay to be on HEAD <img src='http://merbist.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>FYI the problem comes from the fact that DM doesn&#8217;t add a to_params method to its objects. Rails users might recognize that method used to convert an object into a string to create a route, something not really ORM agnostic and frowned upon by the DM/Merb teams.</p>
<p>Merb lets you specify the param to use for your routes using the identify method. Read <a title="new router" href="http://github.com/carllerche/merb-core-enterprise-edition/wikis/whats-new-with-the-router" target="_blank">Carl&#8217;s wiki page </a>for more cool stuff and see how to create some cool stuff like url slugs etc..</p>
<p>Note that even if you are using ActiveRecord, you&#8217;ll need to update merb_activerecord as the new identify rules were updated in the ORM plugins.</p>
]]></content:encoded>
			<wfw:commentRss>http://merbist.com/2008/09/30/problems-with-urls-in-merb-head/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>News from the front line &#8211; Sept 24 2008</title>
		<link>http://merbist.com/2008/09/24/news-from-the-front-line-sept-24-2008/</link>
		<comments>http://merbist.com/2008/09/24/news-from-the-front-line-sept-24-2008/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 16:47:24 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[bundling]]></category>
		<category><![CDATA[edge]]></category>
		<category><![CDATA[head]]></category>
		<category><![CDATA[merb]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[router]]></category>

		<guid isPermaLink="false">http://merbist.com/?p=36</guid>
		<description><![CDATA[Dear Merbivores/Merbists/Merbians, It&#8217;s hard to believe that in less that 20 days, Merb 1.0 will be released! We are all really happy to to be almost there but we have to be honest and admit that we are also under pressure. We are all dreaming of a post 1.0 world but in the meantime we [...]]]></description>
			<content:encoded><![CDATA[<p>Dear Merbivores/Merbists/Merbians,</p>
<p>It&#8217;s hard to believe that in <a title="merbcamp" href="http://merbcamp.com" target="_blank">less that 20 days</a>, Merb 1.0 will be released! We are all really happy to to be almost there but we have to be honest and admit that we are also under pressure.</p>
<p>We are all dreaming of a post 1.0 world but in the meantime we have to focus on last minutes bugs and optimization.</p>
<p><a href="http://flickr.com/photos/16596714@N00/355242291/"><img class="alignleft" style="border: 2px solid black; margin: 20px;" title="News from the front" src="http://farm1.static.flickr.com/128/355242291_40cf729cd9_m.jpg" alt="" width="240" height="180" /></a></p>
<p>During the last week or so, we made a lot of progress, the API is now &#8220;almost&#8221; frozen and <a title="Yehuda Katz" href="http://yehudakatz.com/" target="_blank">General Katz</a> is focusing on making sure everything will be fine for D Day.</p>
<p>That reminds me that Katz showed me something amazing yesterday! I shouldn&#8217;t really talk about it but I&#8217;m sure it will stay between us. He was been working on optimizing the general memory consumption and my testing app (real app) went from 120MB of Private Memory used, to 70MB (using 4 processes). I can&#8217;t wait to use that on the field. I also hope my old Rails comrades will realize that running ~100Mb processes (x4) really isn&#8217;t efficient and event dangerous for the free Ruby world!</p>
<p>I also heard rumors that the higher officers are now using a new strategic tool called <a title="PIvotaltracker" href="http://www.pivotaltracker.com" target="_blank">http://www.pivotaltracker.com</a> which should help us streamline the process. We are still using <a title="lighthouse" href="http://merb.lighthouseapp.com" target="_blank">LightHouse</a> to track bugs and patches though. I&#8217;m not sure if this new &#8220;agile&#8221; tool will help, but I thought the approach is pretty interesting. What do you think?</p>
<p><a href="http://flickr.com/photos/celtico/2556999427/"><img class="alignright" style="margin: 20px;" title="Captain at the gym" src="http://farm4.static.flickr.com/3138/2556999427_546c5004f6_m.jpg" alt="" width="184" height="240" /></a></p>
<p>You probably also saw my early report on <a title="bundling a merb app" href="http://merbist.com/2008/09/23/deploying-a-bundled-merb-app-merb-097/" target="_blank">bundling Merb apps</a>, I&#8217;m quite happy about the process. Do you think you will deploy bundled/frozen apps or just use the system-wide gems?</p>
<p><a href="http://farm4.static.flickr.com/3097/2884670329_15385e8516.jpg"><br />
</a></p>
<p>Finally I hear a lot of talk about the <a href="http://github.com/carllerche/merb-core-enterprise-edition/wikis/whats-new-with-the-router" target="_blank">new Route</a>r that&#8217;s available on <a title="merb HEAD" href="http://github.com/wycats/merb-core/tree/master" target="_blank">Edge/HEAD</a>. Officer Lerch wrote a <a title="new merb router" href="http://github.com/carllerche/merb-core-enterprise-edition/wikis/whats-new-with-the-router" target="_blank">nice wiki article</a> covering the changes, you might want to <a title="new merb router" href="http://github.com/carllerche/merb-core-enterprise-edition/wikis/whats-new-with-the-router" target="_blank">read it</a>.</p>
<p>Ohh before I forget, some courageous privates went to <a href="http://github.com/wycats/merb-core/tree/master" target="_blank">HEAD</a> and use the 3rd party plugin called <a title="merb auth" href="http://github.com/hassox/merb-auth/tree/master" target="_blank">merb-auth</a>. What they don&#8217;t know is that they need to change their routes to use the slices with the new router. (the new router requires no block variable) Also, if they look at the merb-auth branches they will notice a new <a title="mauth" href="http://github.com/hassox/merb-auth/tree/mauth" target="_blank">mauth branch</a> which is the new version of merb-auth, even better, more flexible than the previous version.</p>
<p>I hope everything is well for you, say Hi! to our friends for me.</p>
<p>- Merbist</p>
]]></content:encoded>
			<wfw:commentRss>http://merbist.com/2008/09/24/news-from-the-front-line-sept-24-2008/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

