<?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>Railstic</title>
	<atom:link href="http://railstic.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://railstic.com</link>
	<description>sharing experiences</description>
	<lastBuildDate>Mon, 29 Aug 2011 00:31:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Check Existence of DelayedJob Records</title>
		<link>http://railstic.com/2011/08/check-existence-of-delayedjob-records/</link>
		<comments>http://railstic.com/2011/08/check-existence-of-delayedjob-records/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 00:23:19 +0000</pubDate>
		<dc:creator>İ. Emre Kutlu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://railstic.com/?p=217</guid>
		<description><![CDATA[I&#8217;m using the collectiveidea fork of DelayedJob. There are two ways to create a DelayedJob record. First you can use the delay method. Second way to create DelayedJob records is custom jobs.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using the collectiveidea fork of <a href="http://github.com/collectiveidea/delayed_job" target="_blank">DelayedJob</a>. There are two ways to create a DelayedJob record. First you can use the <code>delay</code> method.</p>
<div id="gist-1177431" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="k">class</span> <span class="nc">User</span></div><div class='line' id='LC2'>&nbsp;&nbsp;<span class="k">class</span> <span class="o">&lt;&lt;</span> <span class="nb">self</span></div><div class='line' id='LC3'><br/></div><div class='line' id='LC4'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">long_process</span><span class="p">(</span><span class="n">args</span><span class="p">)</span></div><div class='line' id='LC5'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">#long running process</span></div><div class='line' id='LC6'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">end</span></div><div class='line' id='LC7'><br/></div><div class='line' id='LC8'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">def</span> <span class="nf">create_delayed_job_for_long_process</span><span class="p">(</span><span class="n">args</span><span class="p">)</span></div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">#check the existence of DelayedJob record</span></div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">unless</span> <span class="no">Delayed</span><span class="o">::</span><span class="no">Job</span><span class="o">.</span><span class="n">exists?</span><span class="p">(</span><span class="ss">:handler</span> <span class="o">=&gt;</span> <span class="no">Delayed</span><span class="o">::</span><span class="no">Job</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="ss">:payload_object</span> <span class="o">=&gt;</span> <span class="no">Delayed</span><span class="o">::</span><span class="no">PerformableMethod</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="nb">self</span><span class="p">,</span> <span class="ss">:request_without_send_later</span><span class="p">,</span> <span class="nb">Array</span><span class="o">.</span><span class="n">wrap</span><span class="p">(</span><span class="n">args</span><span class="p">)))</span><span class="o">.</span><span class="n">handler</span><span class="p">,</span> <span class="ss">:locked_at</span> <span class="o">=&gt;</span> <span class="kp">nil</span><span class="p">)</span></div><div class='line' id='LC11'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">self</span><span class="o">.</span><span class="n">delay</span><span class="o">.</span><span class="n">long_process</span><span class="p">(</span><span class="n">args</span><span class="p">)</span></div><div class='line' id='LC12'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">end</span></div><div class='line' id='LC13'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">end</span></div><div class='line' id='LC14'><br/></div><div class='line' id='LC15'>&nbsp;&nbsp;<span class="k">end</span></div><div class='line' id='LC16'><span class="k">end</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1177431/9b1e37ccc9034491c8bb0dd0b5cc879052e85edb/dj_delay.rb" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1177431#file_dj_delay.rb" style="float:right;margin-right:10px;color:#666">dj_delay.rb</a>
            <a href="https://gist.github.com/1177431">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>Second way to create DelayedJob records is custom jobs.</p>
<div id="gist-1177431" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="c1">#A Custom job is a class with a method called perform</span></div><div class='line' id='LC2'><span class="k">class</span> <span class="nc">User</span></div><div class='line' id='LC3'>&nbsp;&nbsp;<span class="k">def</span> <span class="nf">perform</span></div><div class='line' id='LC4'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">#long running process</span></div><div class='line' id='LC5'>&nbsp;&nbsp;<span class="k">end</span></div><div class='line' id='LC6'><span class="k">end</span></div><div class='line' id='LC7'><br/></div><div class='line' id='LC8'><span class="c1">#check existence of DelayedJob record</span></div><div class='line' id='LC9'><span class="no">Delayed</span><span class="o">::</span><span class="no">Job</span><span class="o">.</span><span class="n">exists?</span><span class="p">(</span><span class="ss">:handler</span> <span class="o">=&gt;</span> <span class="no">Delayed</span><span class="o">::</span><span class="no">Job</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="ss">:payload_object</span> <span class="o">=&gt;</span> <span class="no">User</span><span class="o">.</span><span class="n">new</span><span class="p">)</span><span class="o">.</span><span class="n">handler</span><span class="p">,</span> <span class="ss">:locked_at</span> <span class="o">=&gt;</span> <span class="kp">nil</span><span class="p">)</span></div><div class='line' id='LC10'><br/></div><div class='line' id='LC11'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1177431/b0878f950970ce5e7ce12ed23599dc34d612daed/dj_custom_job.rb" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1177431#file_dj_custom_job.rb" style="float:right;margin-right:10px;color:#666">dj_custom_job.rb</a>
            <a href="https://gist.github.com/1177431">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://railstic.com/2011/08/check-existence-of-delayedjob-records/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamically Defining Methods with define_method</title>
		<link>http://railstic.com/2011/06/dynamically-defining-methods-with-define_method/</link>
		<comments>http://railstic.com/2011/06/dynamically-defining-methods-with-define_method/#comments</comments>
		<pubDate>Fri, 10 Jun 2011 23:08:08 +0000</pubDate>
		<dc:creator>İ. Emre Kutlu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[define_method]]></category>
		<category><![CDATA[metaprogramming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[singleton class]]></category>

		<guid isPermaLink="false">http://railstic.com/?p=190</guid>
		<description><![CDATA[If you have been hacking ruby for a while you should have heard that &#8220;Everything is an object&#8221;. To understand this concept knowing what a singleton class is important. Yehuda Katz&#8217;s post is a good source for it. My ruby version 1.9.2. First I&#8217;m going to show you how to add methods to instances by using [...]]]></description>
			<content:encoded><![CDATA[<p>If you have been hacking ruby for a while you should have heard that &#8220;Everything is an object&#8221;. To understand this concept knowing what a <strong>singleton class</strong> is important. <a href="http://yehudakatz.com/2009/11/15/metaprogramming-in-ruby-its-all-about-the-self/" target="_blank">Yehuda Katz&#8217;s post</a> is a good source for it.</p>
<p>My ruby version 1.9.2.</p>
<div id="gist-1009449" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="nv">$ </span>ruby -v</div><div class='line' id='LC2'>ruby 1.9.2p136 <span class="o">(</span>2010-12-25 revision 30365<span class="o">)</span> <span class="o">[</span>i686-linux<span class="o">]</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1009449/8655aae42c2a00cc5bb1b72d2387221964b62ce1/ruby_version.bash" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1009449#file_ruby_version.bash" style="float:right;margin-right:10px;color:#666">ruby_version.bash</a>
            <a href="https://gist.github.com/1009449">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>First I&#8217;m going to show you how to add methods to instances by using <code><strong>define_method</strong></code>.</p>
<p><script src="https://gist.github.com/1009449.js?file=add_instance_methods.rb"></script></p>
<p>You can also write an instance method to create instance methods. <code><strong>send</strong></code> must be used because <code><strong>define_method</strong></code> is private.</p>
<p><script src="https://gist.github.com/1009449.js?file=add_instance_methods_by_instance_method.rb"></script></p>
<p>Write a singleton method to create instance methods.</p>
<p><script src="https://gist.github.com/1009449.js?file=add_instance_methods_by_singleton_method.rb"></script></p>
<p>Now it is time to add singleton methods. When we call <code><strong>define_method</strong></code>, it creates an instance method. What we have to do is call <code><strong>define_method</strong></code> on class&#8217; singleton class.</p>
<p>Getting singleton class of a class:</p>
<p><script src="https://gist.github.com/1009449.js?file=get_singleton_class.rb"></script></p>
<p>First defining singleton method to create singleton methods.</p>
<p><script src="https://gist.github.com/1009449.js?file=add_singleton_methods_by_singleton_method.rb"></script></p>
<p>Then defining instance method to create singleton methods.</p>
<p><script src="https://gist.github.com/1009449.js?file=add_singleton_methods_by_instance_method.rb"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://railstic.com/2011/06/dynamically-defining-methods-with-define_method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nested Object Forms with has_one Relation</title>
		<link>http://railstic.com/2009/06/nested-object-forms-with-has_one-relation/</link>
		<comments>http://railstic.com/2009/06/nested-object-forms-with-has_one-relation/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 15:40:30 +0000</pubDate>
		<dc:creator>İ. Emre Kutlu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://railstic.com/?p=138</guid>
		<description><![CDATA[Rails 2.3 has a good solution for multi model forms. But there is not much examples of  how to use accepts_nested_attributes_for with has_one relation. Assume that we have a Book model which has one Author. Controller : View: No special action is needed for create method of BooksController,  attr_accessible is not necessary for Book model. [...]]]></description>
			<content:encoded><![CDATA[<p>Rails 2.3 has a good solution for multi model forms. But there is not much examples of  how to use<code> <strong>accepts_nested_attributes_for</strong></code> with <code><strong>has_one</strong></code> relation.</p>
<p>Assume that we have a Book model which has one Author.<br />
<script src="http://snipt.net/embed/821f03288846297c2cf43c34766a38f7" type="text/javascript"><!--mce:0--></script><br />
<script src="http://snipt.net/embed/02bd92faa38aaa6cc0ea75e59937a1ef" type="text/javascript"><!--mce:1--></script><br />
<br />
Controller :<script src="http://snipt.net/embed/f0ef6bf2d1b0bc59796999ff717bf149" type="text/javascript"><!--mce:2--></script><br />
<br />
View:<br />
<script src="http://snipt.net/embed/2b2d98bcfa219f53623aa6c1f1301a01" type="text/javascript"><!--mce:3--></script><br />
<br />
No special action is needed for <strong><code>create</code></strong> method of BooksController,  <strong>attr_accessible</strong> is not necessary for Book model. Just don&#8217;t forget to add the second parameter (<strong><code>@book</code></strong>) of <strong><code>form_for</code></strong> and build your nested object (@book.build_author).</p>
]]></content:encoded>
			<wfw:commentRss>http://railstic.com/2009/06/nested-object-forms-with-has_one-relation/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tidbit: Converting Strings with Line Feed to Array</title>
		<link>http://railstic.com/2009/01/tidbit-converting-strings-with-line-feed-to-array/</link>
		<comments>http://railstic.com/2009/01/tidbit-converting-strings-with-line-feed-to-array/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 10:08:02 +0000</pubDate>
		<dc:creator>İ. Emre Kutlu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://railstic.com/?p=126</guid>
		<description><![CDATA[If you have trouble when converting string to array, check if your string includes any line feed (\n). Check how Array("string") behaves: irb&#40;main&#41;:001:0&#62; Array&#40;&#34;izzet emre \nkutlu&#34;&#41; =&#62; &#91;&#34;izzet emre \n&#34;, &#34;kutlu&#34;&#93; This output is not what most of the people expected. Be careful!]]></description>
			<content:encoded><![CDATA[<p>If you have trouble when converting string to array, check if your string includes any line feed (\n). Check how <code>Array("string")</code> behaves:</p>

<div class="wp_codebox"><table><tr id="p1262"><td class="code" id="p126code2"><pre class="bash" style="font-family:monospace;">irb<span style="color: #7a0874; font-weight: bold;">&#40;</span>main<span style="color: #7a0874; font-weight: bold;">&#41;</span>:001:<span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">&gt;</span> Array<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;izzet emre <span style="color: #000099; font-weight: bold;">\n</span>kutlu&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
=<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">&quot;izzet emre <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, <span style="color: #ff0000;">&quot;kutlu&quot;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></td></tr></table></div>

<p>This output is not what most of the people expected. Be careful!</p>
]]></content:encoded>
			<wfw:commentRss>http://railstic.com/2009/01/tidbit-converting-strings-with-line-feed-to-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WorkingWithRails WordPress Plugin</title>
		<link>http://railstic.com/2008/12/workingwithrails-wordpress-plugin/</link>
		<comments>http://railstic.com/2008/12/workingwithrails-wordpress-plugin/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 20:39:45 +0000</pubDate>
		<dc:creator>İ. Emre Kutlu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://railstic.com/?p=103</guid>
		<description><![CDATA[A simple plugin which displays Working With Rails recommendation badge. Download the plugin. Extract the plugin to your wordpress plugin directory. Activate the plugin. Add the widget to your sidebar. Enter your information. It&#8217;s version is 0.1 so comments will be appreciated.]]></description>
			<content:encoded><![CDATA[<p>
A simple plugin which displays <a href="http://www.workingwithrails.com" target="_blank">Working With Rails</a> recommendation badge.
</p>
<ol style="padding-left:30px">
<li><a href="http://railstic.com/wp-content/uploads/wwrails_badge.zip">Download</a> the plugin.</li>
<li>Extract the plugin to your wordpress plugin directory.</li>
<li>Activate the plugin.</li>
<li>Add the widget to your sidebar.</li>
<li>Enter your information.</li>
</ol>
<p></p>
<p>
It&#8217;s version is 0.1 so comments will be appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://railstic.com/2008/12/workingwithrails-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 2.2 &amp; Inflector</title>
		<link>http://railstic.com/2008/12/rails-22-inflector/</link>
		<comments>http://railstic.com/2008/12/rails-22-inflector/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 22:14:52 +0000</pubDate>
		<dc:creator>İ. Emre Kutlu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[inflector]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://izzetemrekutlu.com/blog/?p=92</guid>
		<description><![CDATA[If you have recently updated to Rails 2.2.2, you may encounter this error when you want to start your application: /.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in `load_missing_constant': uninitialized constant Inflector (NameError) As I learned from Paul&#8217;s post usage of Inflector class is changed a bit. You can see the difference when you compare the inflections.rb files. Path of the file [...]]]></description>
			<content:encoded><![CDATA[<p>If you have recently updated to Rails 2.2.2, you may encounter this error when you want to start your application:</p>

<div class="wp_codebox"><table><tr id="p926"><td class="code" id="p92code6"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>.gem<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>activesupport-2.2.2<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>active_support<span style="color: #000000; font-weight: bold;">/</span>dependencies.rb:<span style="color: #000000;">445</span>:<span style="color: #000000; font-weight: bold;">in</span>
<span style="color: #000000; font-weight: bold;">`</span>load_missing_constant<span style="color: #ff0000;">': uninitialized constant Inflector (NameError)</span></pre></td></tr></table></div>

<p>As I learned from <a href="http://paulsturgess.co.uk/articles/show/76-load_missing_constant-uninitialized-constant-inflector-when-upgrading-to-ruby-on-rails-222" target="_blank">Paul&#8217;s post</a> usage of <code>Inflector</code> class is changed a bit. You can see the difference when you compare the inflections.rb files. Path of the file is <em>yourApp/config/initializers/inflections.rb</em></p>
<p>inflections.rb (Rails 2.1.0)</p>

<div class="wp_codebox"><table><tr id="p927"><td class="code" id="p92code7"><pre class="ruby" style="font-family:monospace;"> <span style="color:#CC00FF; font-weight:bold;">Inflector</span>.<span style="color:#9900CC;">inflections</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>inflect<span style="color:#006600; font-weight:bold;">|</span>
  .
  .
  .
 <span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>inflections.rb (Rails 2.2.2)</p>

<div class="wp_codebox"><table><tr id="p928"><td class="code" id="p92code8"><pre class="ruby" style="font-family:monospace;"> ActiveSupport::<span style="color:#CC00FF; font-weight:bold;">Inflector</span>.<span style="color:#9900CC;">inflections</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>inflect<span style="color:#006600; font-weight:bold;">|</span>
  .
  .
  .
 <span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>In my situation changing <code>Inflector</code> to <code>ActiveSupport::Inflector</code> was enough to solve the problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://railstic.com/2008/12/rails-22-inflector/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Updating RubyGems to 1.2 (Manually)</title>
		<link>http://railstic.com/2008/08/updating-rubygems-to-12-manually/</link>
		<comments>http://railstic.com/2008/08/updating-rubygems-to-12-manually/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 12:34:50 +0000</pubDate>
		<dc:creator>İ. Emre Kutlu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://izzetemrekutlu.com/blog/?p=45</guid>
		<description><![CDATA[This is what happened when I want to install rmagick gem. username@username-desktop:~$ sudo gem install rmagick Bulk updating Gem source index for: http://gems.rubyforge.org/ ERROR: could not find rmagick locally or in a repository What the hell&#8230; After some googling I found that RubGems 1.1.x is buggy and and update to RubyGems 1.2 is necessary. To [...]]]></description>
			<content:encoded><![CDATA[<p>
This is what happened when I want to install rmagick gem.<br />
</p>

<div class="wp_codebox"><table><tr id="p4515"><td class="code" id="p45code15"><pre class="bash" style="font-family:monospace;">username<span style="color: #000000; font-weight: bold;">@</span>username-desktop:~$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> rmagick
Bulk updating Gem <span style="color: #7a0874; font-weight: bold;">source</span> index <span style="color: #000000; font-weight: bold;">for</span>: http:<span style="color: #000000; font-weight: bold;">//</span>gems.rubyforge.org<span style="color: #000000; font-weight: bold;">/</span>
ERROR:  could not <span style="color: #c20cb9; font-weight: bold;">find</span> rmagick locally or <span style="color: #000000; font-weight: bold;">in</span> a repository</pre></td></tr></table></div>

<p>
What the hell&#8230;<br />
After some googling I found that RubGems 1.1.x is buggy and and update to RubyGems 1.2 is necessary.<br />
To learn your RubyGems version:<br />
</p>

<div class="wp_codebox"><table><tr id="p4516"><td class="code" id="p45code16"><pre class="bash" style="font-family:monospace;">username<span style="color: #000000; font-weight: bold;">@</span>username-desktop:~$ gem <span style="color: #660033;">-v</span>
1.1.0</pre></td></tr></table></div>

<p><span id="more-45"></span><br />
 I try to update RubyGems :<br />
</p>

<div class="wp_codebox"><table><tr id="p4517"><td class="code" id="p45code17"><pre class="bash" style="font-family:monospace;">username<span style="color: #000000; font-weight: bold;">@</span>username-desktop:~$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem update <span style="color: #660033;">--system</span>
Updating RubyGems
Bulk updating Gem <span style="color: #7a0874; font-weight: bold;">source</span> index <span style="color: #000000; font-weight: bold;">for</span>: http:<span style="color: #000000; font-weight: bold;">//</span>gems.rubyforge.org<span style="color: #000000; font-weight: bold;">/</span>
Nothing to update</pre></td></tr></table></div>

<p>
After this failed attempt, I realized that RubyGems 1.1.x is really buggy. So I must go on manually to update RubyGems.<br />
<br />
<strong>Now the solution:</strong><br />
</p>
<ol>
<li>
Download <a href="http://rubyforge.org/frs/download.php/38844/rubygems-update-1.2.0.gem">rubygems-update-1.2.0.gem</a>
</li>
<li>
Change your directory where your downloaded gem is. In these example my gem is at Desktop.<br />
Now you must install <em>rubygems-update-1.2.0.gem</em>.</p>

<div class="wp_codebox"><table><tr id="p4518"><td class="code" id="p45code18"><pre class="bash" style="font-family:monospace;">username<span style="color: #000000; font-weight: bold;">@</span>username-desktop:~$ <span style="color: #7a0874; font-weight: bold;">cd</span> Desktop<span style="color: #000000; font-weight: bold;">/</span>
username<span style="color: #000000; font-weight: bold;">@</span>username-desktop:~<span style="color: #000000; font-weight: bold;">/</span>Desktop$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> rubygems-update-1.2.0.gem</pre></td></tr></table></div>

</li>
<li>

<div class="wp_codebox"><table><tr id="p4519"><td class="code" id="p45code19"><pre class="bash" style="font-family:monospace;">username<span style="color: #000000; font-weight: bold;">@</span>username-desktop:~<span style="color: #007800;">$sudo</span> update_rubygems</pre></td></tr></table></div>

</li>
</ol>
<p>
To check if our process is successful :<br />
</p>

<div class="wp_codebox"><table><tr id="p4520"><td class="code" id="p45code20"><pre class="bash" style="font-family:monospace;">username<span style="color: #000000; font-weight: bold;">@</span>username-desktop:~<span style="color: #007800;">$gem</span> <span style="color: #660033;">-v</span>
1.2.0</pre></td></tr></table></div>

<p>
If you see <em>1.2.0</em>, you did it.</p>
]]></content:encoded>
			<wfw:commentRss>http://railstic.com/2008/08/updating-rubygems-to-12-manually/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Recursive methods with block in Ruby</title>
		<link>http://railstic.com/2008/08/recursive-methods-with-block/</link>
		<comments>http://railstic.com/2008/08/recursive-methods-with-block/#comments</comments>
		<pubDate>Tue, 26 Aug 2008 10:46:17 +0000</pubDate>
		<dc:creator>İ. Emre Kutlu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[recursive]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://izzetemrekutlu.com/blog/?p=20</guid>
		<description><![CDATA[def comic&#40;cast&#41; cast.each do &#124;character&#124; unless character.is_a?&#40;Array&#41; yield&#40;character&#41; else comic&#40;character&#41; &#123;&#124;x&#124; yield x&#125; end end end This method takes an array as argument and checks each element if it is an Array. If the element is not an Array then the block is called. If the element is an Array then the same method is [...]]]></description>
			<content:encoded><![CDATA[<p></p>

<div class="wp_codebox"><table><tr id="p2024"><td class="code" id="p20code24"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> comic<span style="color:#006600; font-weight:bold;">&#40;</span>cast<span style="color:#006600; font-weight:bold;">&#41;</span>
   cast.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>character<span style="color:#006600; font-weight:bold;">|</span>
      <span style="color:#9966CC; font-weight:bold;">unless</span> character.<span style="color:#9900CC;">is_a</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">Array</span><span style="color:#006600; font-weight:bold;">&#41;</span>
         <span style="color:#9966CC; font-weight:bold;">yield</span><span style="color:#006600; font-weight:bold;">&#40;</span>character<span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#9966CC; font-weight:bold;">else</span>
	 comic<span style="color:#006600; font-weight:bold;">&#40;</span>character<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>x<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#9966CC; font-weight:bold;">yield</span> x<span style="color:#006600; font-weight:bold;">&#125;</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></td></tr></table></div>

<p>
This method takes an array as argument and checks each element if it is an <em>Array</em>.<br />
If the element is not an <em>Array</em> then the block is called.<br />
If the element is an <em>Array</em> then the same method is called with that element as an argument and with the same block.<br />
<br />
Now let&#8217;s look how we can call this method.</p>

<div class="wp_codebox"><table><tr id="p2025"><td class="code" id="p20code25"><pre class="ruby" style="font-family:monospace;">names = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'lucky luke'</span>, <span style="color:#996600;">'jolly jumper'</span>, <span style="color:#996600;">'rin tin tin'</span>, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'joe'</span>, <span style="color:#996600;">'william'</span>,<span style="color:#996600;">'jack'</span>, <span style="color:#996600;">'averell'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
comic<span style="color:#006600; font-weight:bold;">&#40;</span>names<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>c<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#CC0066; font-weight:bold;">puts</span> c<span style="color:#006600; font-weight:bold;">&#125;</span></pre></td></tr></table></div>

<p>
<strong>Output :</strong></p>

<div class="wp_codebox"><table><tr id="p2026"><td class="code" id="p20code26"><pre class="bash" style="font-family:monospace;">lucky luke
jolly jumper
rin tin tin
joe
william
jack
averell</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://railstic.com/2008/08/recursive-methods-with-block/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to check if a div exists in rjs?</title>
		<link>http://railstic.com/2008/08/how-to-check-if-a-div-exists-in-rjs/</link>
		<comments>http://railstic.com/2008/08/how-to-check-if-a-div-exists-in-rjs/#comments</comments>
		<pubDate>Sun, 24 Aug 2008 17:52:36 +0000</pubDate>
		<dc:creator>İ. Emre Kutlu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rjs]]></category>

		<guid isPermaLink="false">http://izzetemrekutlu.com/blog/?p=3</guid>
		<description><![CDATA[&#60;body&#62; &#60;div id='main'&#62; Main Div &#60;/div&#62; &#60;/body&#62; render :update do &#124;page&#124; page &#60;&#60; &#34;if ($('main')){&#34; page.replace_html 'main', :inline =&#62; 'Here it is' page &#60;&#60; &#34;}&#34; end This ruby code checks if there is a DOM object that its id = &#8220;main&#8221;. If there is then changes its content to &#8220;Here it is&#8221;, if there is [...]]]></description>
			<content:encoded><![CDATA[<p></p>

<div class="wp_codebox"><table><tr id="p17229"><td class="code" id="p172code29"><pre class="html4strict" style="font-family:monospace;">&lt;body&gt;
   &lt;div id='main'&gt;
      Main Div
   &lt;/div&gt;
&lt;/body&gt;</pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p17230"><td class="code" id="p172code30"><pre class="ruby" style="font-family:monospace;">render <span style="color:#ff3333; font-weight:bold;">:update</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>page<span style="color:#006600; font-weight:bold;">|</span>
   page <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot;if ($('main')){&quot;</span>
   page.<span style="color:#9900CC;">replace_html</span> <span style="color:#996600;">'main'</span>, <span style="color:#ff3333; font-weight:bold;">:inline</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'Here it is'</span>
   page <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot;}&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>This ruby code checks if there is a DOM object that its id = &#8220;main&#8221;.<br />
If there is then changes its content to &#8220;Here it is&#8221;, if there is not do nothing.</p>
]]></content:encoded>
			<wfw:commentRss>http://railstic.com/2008/08/how-to-check-if-a-div-exists-in-rjs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

