<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Empty Variables</title>
	<atom:link href="http://railsforphp.com/2008/09/23/empty-variables/feed/" rel="self" type="application/rss+xml" />
	<link>http://railsforphp.com/2008/09/23/empty-variables/</link>
	<description></description>
	<lastBuildDate>Wed, 28 Jul 2010 02:42:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: James</title>
		<link>http://railsforphp.com/2008/09/23/empty-variables/comment-page-1/#comment-14997</link>
		<dc:creator>James</dc:creator>
		<pubDate>Thu, 27 May 2010 19:37:27 +0000</pubDate>
		<guid isPermaLink="false">http://railsforphp.com/?p=58#comment-14997</guid>
		<description>I am having this problem right now - thanks for clarifying!</description>
		<content:encoded><![CDATA[<p>I am having this problem right now &#8211; thanks for clarifying!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hoopla</title>
		<link>http://railsforphp.com/2008/09/23/empty-variables/comment-page-1/#comment-13951</link>
		<dc:creator>hoopla</dc:creator>
		<pubDate>Thu, 18 Mar 2010 19:31:02 +0000</pubDate>
		<guid isPermaLink="false">http://railsforphp.com/?p=58#comment-13951</guid>
		<description>i suffered the same issue when I began.</description>
		<content:encoded><![CDATA[<p>i suffered the same issue when I began.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sompylasar</title>
		<link>http://railsforphp.com/2008/09/23/empty-variables/comment-page-1/#comment-12308</link>
		<dc:creator>sompylasar</dc:creator>
		<pubDate>Sun, 17 Jan 2010 11:57:45 +0000</pubDate>
		<guid isPermaLink="false">http://railsforphp.com/?p=58#comment-12308</guid>
		<description>Am I missing something or the table above states the opposite to &quot;Similarly, it is important to note that zero (0 and &quot;0&quot;) evaluates to true using 0.blank?.&quot;

It says FALSE, FALSE on rows with 0 and &quot;0&quot; and column &quot;x.blank?**&quot;.</description>
		<content:encoded><![CDATA[<p>Am I missing something or the table above states the opposite to &#8220;Similarly, it is important to note that zero (0 and &#8220;0&#8243;) evaluates to true using 0.blank?.&#8221;</p>
<p>It says FALSE, FALSE on rows with 0 and &#8220;0&#8243; and column &#8220;x.blank?**&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck Vose</title>
		<link>http://railsforphp.com/2008/09/23/empty-variables/comment-page-1/#comment-10545</link>
		<dc:creator>Chuck Vose</dc:creator>
		<pubDate>Thu, 29 Oct 2009 00:45:28 +0000</pubDate>
		<guid isPermaLink="false">http://railsforphp.com/?p=58#comment-10545</guid>
		<description>@Tyler for those who read this later (I&#039;m assuming you already found your solution). 

It is a common idiom in ruby to say something like:
person.network.name if person.network
or 
person.network.name unless person.network.nil?

Since a relationship will never return false you really only have to worry about nullity. This is why both above lines work just fine. 

The reason Rails and Ruby don&#039;t return nothing in this context is because nothing is very different than nil. Someone once told me that nothing means you have a phone but no phone-number, null is when you don&#039;t have a phone and your house isn&#039;t even capable of having a phone even if you did have one. 

Besides, returning nothing would break if person.network.name :)</description>
		<content:encoded><![CDATA[<p>@Tyler for those who read this later (I&#8217;m assuming you already found your solution). </p>
<p>It is a common idiom in ruby to say something like:<br />
person.network.name if person.network<br />
or<br />
person.network.name unless person.network.nil?</p>
<p>Since a relationship will never return false you really only have to worry about nullity. This is why both above lines work just fine. </p>
<p>The reason Rails and Ruby don&#8217;t return nothing in this context is because nothing is very different than nil. Someone once told me that nothing means you have a phone but no phone-number, null is when you don&#8217;t have a phone and your house isn&#8217;t even capable of having a phone even if you did have one. </p>
<p>Besides, returning nothing would break if person.network.name :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Php Developer</title>
		<link>http://railsforphp.com/2008/09/23/empty-variables/comment-page-1/#comment-10084</link>
		<dc:creator>Php Developer</dc:creator>
		<pubDate>Fri, 02 Oct 2009 08:38:08 +0000</pubDate>
		<guid isPermaLink="false">http://railsforphp.com/?p=58#comment-10084</guid>
		<description>yes when i start programming with ruby and when switch to PHP i faced same issue.</description>
		<content:encoded><![CDATA[<p>yes when i start programming with ruby and when switch to PHP i faced same issue.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tyler</title>
		<link>http://railsforphp.com/2008/09/23/empty-variables/comment-page-1/#comment-9543</link>
		<dc:creator>Tyler</dc:creator>
		<pubDate>Thu, 03 Sep 2009 15:55:10 +0000</pubDate>
		<guid isPermaLink="false">http://railsforphp.com/?p=58#comment-9543</guid>
		<description>Like many, I started in php and have been switched over to rails for a few months now. So I have a continuing problem along these lines. Say I have a person object and person &quot;belongs_to :network&quot;. Then if i have a person that for whatever reason doesn&#039;t have a network, and I say &quot;person.network.name&quot;, I get an error. Is there a way to just make it return nothing like php instead of raising an error?</description>
		<content:encoded><![CDATA[<p>Like many, I started in php and have been switched over to rails for a few months now. So I have a continuing problem along these lines. Say I have a person object and person &#8220;belongs_to :network&#8221;. Then if i have a person that for whatever reason doesn&#8217;t have a network, and I say &#8220;person.network.name&#8221;, I get an error. Is there a way to just make it return nothing like php instead of raising an error?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: feng</title>
		<link>http://railsforphp.com/2008/09/23/empty-variables/comment-page-1/#comment-7402</link>
		<dc:creator>feng</dc:creator>
		<pubDate>Wed, 17 Jun 2009 05:10:24 +0000</pubDate>
		<guid isPermaLink="false">http://railsforphp.com/?p=58#comment-7402</guid>
		<description>thanks~</description>
		<content:encoded><![CDATA[<p>thanks~</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Toronto PHP</title>
		<link>http://railsforphp.com/2008/09/23/empty-variables/comment-page-1/#comment-6291</link>
		<dc:creator>Toronto PHP</dc:creator>
		<pubDate>Tue, 12 May 2009 03:24:15 +0000</pubDate>
		<guid isPermaLink="false">http://railsforphp.com/?p=58#comment-6291</guid>
		<description>I agree, this leaves too much room for error, not a good idea.</description>
		<content:encoded><![CDATA[<p>I agree, this leaves too much room for error, not a good idea.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: d x m i o . c o m &#187; Links for 09/24/2008</title>
		<link>http://railsforphp.com/2008/09/23/empty-variables/comment-page-1/#comment-3524</link>
		<dc:creator>d x m i o . c o m &#187; Links for 09/24/2008</dc:creator>
		<pubDate>Sun, 25 Jan 2009 10:50:04 +0000</pubDate>
		<guid isPermaLink="false">http://railsforphp.com/?p=58#comment-3524</guid>
		<description>[...] PHP and Rails: variable differences [...]</description>
		<content:encoded><![CDATA[<p>[...] PHP and Rails: variable differences [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Custom PHP</title>
		<link>http://railsforphp.com/2008/09/23/empty-variables/comment-page-1/#comment-2672</link>
		<dc:creator>Custom PHP</dc:creator>
		<pubDate>Wed, 12 Nov 2008 22:53:38 +0000</pubDate>
		<guid isPermaLink="false">http://railsforphp.com/?p=58#comment-2672</guid>
		<description>Might mess someone up if they are going back and forth or working on PHP apps while working on Ruby apps.</description>
		<content:encoded><![CDATA[<p>Might mess someone up if they are going back and forth or working on PHP apps while working on Ruby apps.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
