<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Chee's blog &#187; Merb</title>
	<atom:link href="http://cheeyeo.wordpress.com/category/merb/feed/" rel="self" type="application/rss+xml" />
	<link>http://cheeyeo.wordpress.com</link>
	<description>Observations, tips, tricks, articles on Ruby and anything else that follows.</description>
	<lastBuildDate>Wed, 18 Mar 2009 00:19:55 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='cheeyeo.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/1c59aee0b01111d834f3bfb3e82f9b0d?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Chee's blog &#187; Merb</title>
		<link>http://cheeyeo.wordpress.com</link>
	</image>
			<item>
		<title>FIXING NAMESPACE NOT FOUND ERROR ON MERB</title>
		<link>http://cheeyeo.wordpress.com/2008/09/26/fixing-namespace-not-found-error-on-merb/</link>
		<comments>http://cheeyeo.wordpress.com/2008/09/26/fixing-namespace-not-found-error-on-merb/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 11:13:48 +0000</pubDate>
		<dc:creator>cheeyeo</dc:creator>
				<category><![CDATA[Merb]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[namespace]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://cheeyeo.wordpress.com/?p=40</guid>
		<description><![CDATA[If you have just completed an application, its more than likely you would like to have an admin portal to administer users. The easiest way to do this in Merb is to use the &#8216;merb-gen resource_controller&#8217; command in your application directory to generate a CRUD controller and views for the resource. This is similar to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cheeyeo.wordpress.com&blog=3937360&post=40&subd=cheeyeo&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you have just completed an application, its more than likely you would like to have an admin portal to administer users. The easiest way to do this in Merb is to use the <strong>&#8216;merb-gen resource_controller&#8217;</strong> command in your application directory to generate a CRUD controller and views for the resource. This is similar to using scaffold in rails.</p>
<p>Say for instance I have a resource called Posts and I want to generate an admin front-end to it. All I need to do is change to the application directory and type:</p>
<p>merb-gen resource_controller admin/posts</p>
<p>This creates a subfolder called &#8216;admin&#8217; within your controllers and a new posts controller within that to handle all the CRUD functions. However, on MERB 0.9.5, the controller is missing the module keyword and if you try to run the above you would receive a namespace or controller not found error.</p>
<p>To fix this, open up &#8216;admin/posts&#8217; controller and add &#8216;module Admin&#8217; to the file:</p>
<pre style="text-align:left;"><strong><span style="color:#800000;">module Admin

class Posts &lt; Application

....

end

end</span></strong></pre>
<p>Next add the required namespace to the &#8216;config/router.rb&#8217; file:</p>
<pre><strong><span style="color:#800000;">Merb::Router.prepare do |r|

r.namespace :admin do |admin|

admin.resources :posts

end

end</span></strong></pre>
<p>Fire up your app and it should all work. I&#8217;m not certain if this is fixed in subsequent versions of Merb but I did notice a ticket has been submitted for nested namespaces error. If anyone reading this has more information on the official line, please do leave a comment</p>
<p>NEWS FLASH:</p>
<p>Just received an up-to-date comment from one of the MERB framework developers who read this post and confirmed that the latest version of &#8216;merb-gen&#8217; has been fixed to prevent the error above. So upgrade your version of Merb to prevent it. And you still have to add in the namespace in your router file manually.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cheeyeo.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cheeyeo.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cheeyeo.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cheeyeo.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cheeyeo.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cheeyeo.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cheeyeo.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cheeyeo.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cheeyeo.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cheeyeo.wordpress.com/40/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cheeyeo.wordpress.com&blog=3937360&post=40&subd=cheeyeo&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cheeyeo.wordpress.com/2008/09/26/fixing-namespace-not-found-error-on-merb/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">cheeyeo</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Rack</title>
		<link>http://cheeyeo.wordpress.com/2008/08/20/using-rack/</link>
		<comments>http://cheeyeo.wordpress.com/2008/08/20/using-rack/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 14:07:40 +0000</pubDate>
		<dc:creator>cheeyeo</dc:creator>
				<category><![CDATA[Merb]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://cheeyeo.wordpress.com/?p=15</guid>
		<description><![CDATA[I heve been experimenting with Rack for a while and thought I would write a short post about it here.
In essence, Rack is an API that sits between your web framework and the webserver itself. A basic Rack application consists of a call method that takes a hash of environmen variabes such as whre the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cheeyeo.wordpress.com&blog=3937360&post=15&subd=cheeyeo&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I heve been experimenting with Rack for a while and thought I would write a short post about it here.</p>
<p>In essence, Rack is an API that sits between your web framework and the webserver itself. A basic Rack application consists of a call method that takes a hash of environmen variabes such as whre the request comes from and returns a hash of variables containing a status code, content-type and a response string.</p>
<p>A minimal Rack application is listed below:</p>
<pre>  <strong>%w(rubygems rack).each {|dep| require dep}

  app = lambda{|env| [200, {}, 'Another Test!']}

  Rack::Handler::Mongrel.run(app, <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ort=&gt; 3000)</strong></pre>
<p>Make sure the Rack gem in installed onto your local system first. Fire up the console and run the script.</p>
<p>You will see a flashing command prompt as the script is waiting to receive a HTTP request. Type &#8216;http://localhost:3000/&#8217; into your browser an you should see the string &#8216;Another Test&#8217; being returned to the browser.</p>
<p>I utilised the technique above to create a middleware class in my ongoing Merb application to handle file uploads away from the framework itself but stilll being able to access certain components of the framework (i.e. ActiveRecord objects) if needs to. An example of how to accomplish this can be found on <em><a href="http://brainspl.at/articles/2008/02/16/so-merb-core-is-built-on-rack-you-say-why-should-i-care" target="blank">Ezra&#8217;s blog(the creator of Merb)</a>.</em></p>
<p>A snippet of the middleware code will be made available soon after refactoring.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cheeyeo.wordpress.com/15/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cheeyeo.wordpress.com/15/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cheeyeo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cheeyeo.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cheeyeo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cheeyeo.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cheeyeo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cheeyeo.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cheeyeo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cheeyeo.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cheeyeo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cheeyeo.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cheeyeo.wordpress.com&blog=3937360&post=15&subd=cheeyeo&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cheeyeo.wordpress.com/2008/08/20/using-rack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">cheeyeo</media:title>
		</media:content>
	</item>
		<item>
		<title>Fixing file upload error using MERB on Windows</title>
		<link>http://cheeyeo.wordpress.com/2008/06/09/hello-world/</link>
		<comments>http://cheeyeo.wordpress.com/2008/06/09/hello-world/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 16:03:20 +0000</pubDate>
		<dc:creator>cheeyeo</dc:creator>
				<category><![CDATA[Merb]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[introduction]]></category>
		<category><![CDATA[upload]]></category>
		<category><![CDATA[vista]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I have just started experimenting with the MERB framework recently after using Rails for about a year. Although I am of the opinion that there are far too many web frameworks out there and I&#8217;m still in the process of learning Ruby properly as a language, I can&#8217;t help but be curious about the features [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cheeyeo.wordpress.com&blog=3937360&post=1&subd=cheeyeo&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I have just started experimenting with the MERB framework recently after using Rails for about a year. Although I am of the opinion that there are far too many web frameworks out there and I&#8217;m still in the process of learning Ruby properly as a language, I can&#8217;t help but be curious about the features this much-talked about framework can deliver.</p>
<p>I use a Windows box for development work in the offices. After a few failed attempts to get the gems to install correctly, I setup a simple file uploading script using just a controller as follows:</p>
<p><strong><br />
class Uploader &lt; Application<br />
  &nbsp;&nbsp;def index<br />
    &nbsp;&nbsp;&nbsp;&nbsp;render<br />
  &nbsp;&nbsp;end</p>
<p>  &nbsp;&nbsp;def upload<br />
     &nbsp;&nbsp;&nbsp;&nbsp;FileUtils.mv params[:file][:tempfile].path, Merb.root+&#8221;/uploads/#{params[:file][:filename]}&#8221;</p>
<p>    &nbsp;&nbsp;&nbsp;&nbsp;redirect &#8220;/uploader&#8221;<br />
  end</p>
<p>end<br />
</strong></p>
<p>The controller is uploading a file into the &#8216;uploads&#8217; directory in the application path. However, if you run the above as it is on a windows machine, you would receive a <strong>&#8216;permission denied&#8217;</strong> error. Changing the permissions on the folders would not make any difference.</p>
<p>The only way to fix this is to add a line of code to the gem library as follows:</p>
<ol>
<li>On your windows box, browse to you gem directory and locate &#8216;merb-core-&lt;version&gt;/lib/merb-core/dispatch/request.rb&#8217;.</li>
<li>Browse to line 526 and add the following:
<p>       <code>  else<br />
            data = body<br />
          end (approx line 526 here)<br />
</code><br />
           (only add the body.close line after end on line 526)</p>
<blockquote><p><strong> body.close</strong></p></blockquote>
</li>
</ol>
<p>Save the file. Restart your application and you should find that the controller is able to upload to the specified directory.</p>
<p>Official documentation on this can be found <a href="http://merb.devjavu.com/ticket/440">here</a>.</p>
<p>Although the bug has been found since January this year, I hope that anyone who comes across this problem on Windows will find this useful.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/cheeyeo.wordpress.com/1/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/cheeyeo.wordpress.com/1/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cheeyeo.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cheeyeo.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/cheeyeo.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/cheeyeo.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/cheeyeo.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/cheeyeo.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/cheeyeo.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/cheeyeo.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/cheeyeo.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/cheeyeo.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cheeyeo.wordpress.com&blog=3937360&post=1&subd=cheeyeo&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://cheeyeo.wordpress.com/2008/06/09/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">cheeyeo</media:title>
		</media:content>
	</item>
	</channel>
</rss>