<?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>Rails 2.0 &#187; 開発</title>
	<atom:link href="http://rails20.jp/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://rails20.jp</link>
	<description>Rails開発のTips、ソフトウェア、ライブラリに関する情報をお届けします。Railsの開発受託も行っています。</description>
	<lastBuildDate>Thu, 08 Oct 2009 04:14:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>File.exists?を使わずに…</title>
		<link>http://rails20.jp/2009/09/dont_use_file_exists/</link>
		<comments>http://rails20.jp/2009/09/dont_use_file_exists/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 22:36:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[開発]]></category>
		<category><![CDATA[37signals]]></category>

		<guid isPermaLink="false">http://rails20.jp/2009/09/dont_use_file_exists/</guid>
		<description><![CDATA[&#60;% if File.exists?(model.path) %&#62;
&#160;&#160; ...
&#60;% end %&#62;
ではなく、
&#60;% if model.file_exists? %&#62;
&#160;&#160;...
&#60;% end %&#62;
というのが37signals流。メリットは、

ビューがすっきりする
結果をキャッシュできる
ユニットテストしやすい
ローカルファイルシステムから別システム（S3とかMogileFSとか）へ移すことも想定
MVCとしてモデルがファイルを参照するなら、それがどこにあるかはモデルだけが把握すべき

といったことが挙げられています。
A design and usability blog: Signal vs. Noise (by 37signals)
　http://37signals.com/svn/posts/1944-dont-do-this-if-fileexistsmodel

]]></description>
			<content:encoded><![CDATA[<p><code>&lt;% if File.exists?(model.path) %&gt;<br />
&nbsp;&nbsp; ...<br />
&lt;% end %&gt;</code></p>
<p>ではなく、</p>
<p><code>&lt;% if model.file_exists? %&gt;<br />
&nbsp;&nbsp;...<br />
&lt;% end %&gt;</code></p>
<p>というのが37signals流。メリットは、</p>
<ul>
<li>ビューがすっきりする</li>
<li>結果をキャッシュできる</li>
<li>ユニットテストしやすい</li>
<li>ローカルファイルシステムから別システム（S3とかMogileFSとか）へ移すことも想定</li>
<li>MVCとしてモデルがファイルを参照するなら、それがどこにあるかはモデルだけが把握すべき</li>
</ul>
<p>といったことが挙げられています。</p>
<p><b>A design and usability blog: Signal vs. Noise (by 37signals)</b><br />
　<a href="http://37signals.com/svn/posts/1944-dont-do-this-if-fileexistsmodel">http://37signals.com/svn/posts/1944-dont-do-this-if-fileexistsmodel</a></p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://rails20.jp/2009/09/dont_use_file_exists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
