<?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>uRaNGaTaNG &#187; view</title>
	<atom:link href="http://www.rngtng.com/tag/view/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rngtng.com</link>
	<description>TobiTobes Tech Weblog featuring Ruby, Rails, Web development, Arduino, Processing, Geekstuff and more...</description>
	<lastBuildDate>Thu, 01 Jul 2010 11:36:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Beautify your views using &#8220;return&#8221;</title>
		<link>http://www.rngtng.com/2008/06/06/beautify-your-views-with-using-return/</link>
		<comments>http://www.rngtng.com/2008/06/06/beautify-your-views-with-using-return/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 09:59:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby, Rails & Co.]]></category>
		<category><![CDATA[beauty of code]]></category>
		<category><![CDATA[hint]]></category>
		<category><![CDATA[return]]></category>
		<category><![CDATA[view]]></category>

		<guid isPermaLink="false">http://urangatang.wordpress.com/?p=6</guid>
		<description><![CDATA[A nice way to keep your views clean and not to spoil them with condition clauses, is to use the &#8216;return&#8217; statement like you would do in a method: Take this very simple exmaple: ugly: unless @place &#60;%= @place.name %&#62; end nice: return if @place.nil? &#60;%= @place.name %&#62; UPDATE: There&#8217;s one pitfall, I forgot to [...]]]></description>
			<content:encoded><![CDATA[<p>A nice way to keep your views clean and not to spoil them with condition clauses, is to use the &#8216;return&#8217; statement like you would do in a method:</p>
<p>Take this very simple exmaple:</p>
<p>ugly:</p>
<pre class="brush: ruby;">
unless @place
  &lt;%= @place.name %&gt;
end
</pre>
<p>nice:</p>
<pre class="brush: ruby;">
return if @place.nil?
&lt;%= @place.name %&gt;
</pre>
<p><strong>UPDATE:</strong><br />
There&#8217;s one pitfall, I forgot to mention: Every outout BEFORE the return statement will be discarded, so this part: </p>
<pre class="brush: ruby;">
&lt;%= &quot;Always display this sentence&quot; %&gt;
return if @place.nil?
&lt;%= @place.name %&gt;
</pre>
<p>Will result in an empty output as well. This is quite a pitty and I&#8217;m not sure if it&#8217;s a bug or feature. A may raise it soon..</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rngtng.com/2008/06/06/beautify-your-views-with-using-return/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
