<?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>Gilluminate &#187; Ruby on Rails</title>
	<atom:link href="http://www.gilluminate.com/tag/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gilluminate.com</link>
	<description>By Jason Gill</description>
	<lastBuildDate>Sat, 28 Jan 2012 21:01:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Force Rails Version When Creating a New App</title>
		<link>http://www.gilluminate.com/2009/06/05/force-rails-version-when-creating-a-new-app/</link>
		<comments>http://www.gilluminate.com/2009/06/05/force-rails-version-when-creating-a-new-app/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 21:27:58 +0000</pubDate>
		<dc:creator>Jason Gill</dc:creator>
				<category><![CDATA[Developer Blog]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.gilluminate.com/2009/06/05/force-rails-version-when-creating-a-new-app/</guid>
		<description><![CDATA[I have multiple versions of the Rails gem installed on my development server. We&#8217;ve been using Rails long enough now that we have many apps created for many versions. As I make changes to each app I need to test them in their specific version (the version listed in the environment.rb file) so having multiple [...]]]></description>
			<content:encoded><![CDATA[<p>I have multiple versions of the Rails gem installed on my development server. We&#8217;ve been using Rails long enough now that we have many apps created for many versions. As I make changes to each app I need to test them in their specific version (the version listed in the environment.rb file) so having multiple Rails versions installed is a necessity.</p>
<p>But if I try to spin up a new application using</p>
<pre>$rails new_app</pre>
<p>I get a rails app created specifically for the latest version of Rails installed.</p>
<p>But what if you need to create a new app for an older version of rails that is also installed? The following easy command does the trick:</p>
<pre>$rails _1.2.3_ new_app</pre>
<p>Where 1.2.3 is the desired version of Rails I want new_app to run. Note the underscores before and after the version.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gilluminate.com/2009/06/05/force-rails-version-when-creating-a-new-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Titleize an Array List in Rails</title>
		<link>http://www.gilluminate.com/2009/04/06/titleize-array-list-in-rails/</link>
		<comments>http://www.gilluminate.com/2009/04/06/titleize-array-list-in-rails/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 16:53:38 +0000</pubDate>
		<dc:creator>Jason Gill</dc:creator>
				<category><![CDATA[Developer Blog]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.gilluminate.com/?p=5338</guid>
		<description><![CDATA[First, a trick. If you want to display a comma separated list from an array all you need to do is multiply that array by a comma. &#8220;What&#8217;s that&#8221;, you say? You heard right. If you have an array in the variable @my_array you can simply place the following in your view: &#60;%= @my_array * [...]]]></description>
			<content:encoded><![CDATA[<p>First, a trick. If you want to display a comma separated list from an array all you need to do is multiply that array by a comma. &#8220;What&#8217;s that&#8221;, you say? You heard right. If you have an array in the variable @my_array you can simply place the following in your view:</p>
<pre>&lt;%= @my_array * ", " %&gt;</pre>
<p>The comma and space in your string will be added to the end of every string in your array except for the last one. Beautiful! I love rails.</p>
<p>Now for the reason for my post. While I&#8217;ve known this little trick for a while, I came across the need to titleize the outcome because my array contained all lowercase strings and I wanted to diplay them as titles.</p>
<p>It took a little trial and error, but the solution is rather simple:</p>
<pre>&lt;%= (@my_array * ", ").titleize %&gt;</pre>
<p>To apply the titleize method, you simply wrap your multiplication is parenthesis and add the .titleize as you normally would.</p>
<p>(Note: I still have not upgraded to Rails 2.0, so I cannot guarantee any of this will work in newer versions)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gilluminate.com/2009/04/06/titleize-array-list-in-rails/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Rails Controller Variables not Loading</title>
		<link>http://www.gilluminate.com/2008/07/01/rails-controller-variables-not-loading/</link>
		<comments>http://www.gilluminate.com/2008/07/01/rails-controller-variables-not-loading/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 15:25:29 +0000</pubDate>
		<dc:creator>Jason Gill</dc:creator>
				<category><![CDATA[Developer Blog]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.gilluminate.com/2008/07/01/rails-controller-variables-not-loading/</guid>
		<description><![CDATA[Don&#8217;t forget: &#8220;render :layout =&#62; &#8230;&#8221; should appear below any variables in your controller. I&#8217;ve spent a few hours trying to get the @variables set in my controller to show up in my layout. After much frustration and trying all kinds of fancy ways around my problem, it suddenly occurred to me that I was [...]]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t forget: &#8220;render :layout =&gt; &#8230;&#8221; should appear below any variables in your controller.</p>
<p>I&#8217;ve spent a few hours trying to get the @variables set in my controller to show up in my layout. After much frustration and trying all kinds of fancy ways around my problem, it suddenly occurred to me that I was simply loading the layout before the variables; I was loading them in the wrong order! Grrr&#8230;..</p>
<p>If you are having problems with variables not loading properly, check the order you call the render. It might save you a headache and the need for as much Pepsi as I went through trying to figure this stupid thing out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gilluminate.com/2008/07/01/rails-controller-variables-not-loading/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How I converted Mephisto to WordPress</title>
		<link>http://www.gilluminate.com/2008/05/08/how-i-converted-mephisto-to-wordpress/</link>
		<comments>http://www.gilluminate.com/2008/05/08/how-i-converted-mephisto-to-wordpress/#comments</comments>
		<pubDate>Thu, 08 May 2008 16:36:09 +0000</pubDate>
		<dc:creator>Jason Gill</dc:creator>
				<category><![CDATA[Developer Blog]]></category>
		<category><![CDATA[Mephisto]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blog.gilluminate.com/2008/05/08/how-i-converted-mephisto-to-wordpress/</guid>
		<description><![CDATA[I got a comment the other day asking how I converted to WordPress from Mephisto while keeping my comments and everything intact. If you are familiar with Ruby on Rails, this response will make sense. If you are not, I recommend learning it&#8230;then this response will make sense. In a nutshell, I used Mephisto for [...]]]></description>
			<content:encoded><![CDATA[<p>I got <a href="/2008/03/15/my-blog-is-now-running-on-wordpress/#comment-5273">a comment</a> the other day asking how I converted to WordPress from Mephisto while keeping my comments and everything intact. If you are familiar with Ruby on Rails, this response will make sense. If you are not, I recommend learning it&#8230;then this response will make sense.</p>
<p>In a nutshell, I used Mephisto for the conversion. First I spent about a week mapping Mephisto&#8217;s DB to WordPress&#8217; DB. I went straight into the Mephisto Rails project and created a new model that pointed to my newly created WordPress database. I then created a controller in Mephisto that looked exactly like this:</p>
<p>(note: if this is a pain to read, you can also view it <a href="https://docs.google.com/Doc?docid=dpvmk5b_27fr23rzd4&amp;hl=en">here</a>)</p>
<pre>class MephistoController &lt; ApplicationController
    def index
        start_time = Time.now
        logger.info 'querying mephisto articles'
        @articles = Content.find(:all, :conditions=&gt;"article_id IS NULL")
                logger.info 'querying mephisto comments'
                @comments = Content.find(
			:all, :conditions=&gt;"article_id IS NOT NULL")
        logger.info 'querying mephisto taggings'
        @taggings = Tagging.find(:all)
        logger.info 'querying mephisto tags'
        @tags = Tag.find(:all)
        logger.info 'processing terms'
        for tag in @tags
            @wp_term = WpTerm.new
            @wp_term.term_id = tag.id
            @wp_term.name = tag.name
            @wp_term.slug = tag.name.downcase.gsub(" ","_")
            @wp_term.term_group = 0
            @wp_term.save
        end
        logger.info 'processing term relationships'
        for tagging in @taggings
            @wp_tr = WpTermRelationships.new
            @wp_tr.term_taxonomy_id = tagging.tag_id
            @wp_tr.object_id = tagging.taggable_id
            @wp_tr.save
        end
        logger.info 'processing term taxonomy'
        for tag in @tags
            c = Tagging.count(:all, :conditions=&gt;"tag_id = #{tag.id}")
            @wp_tt = WpTermTaxonomy.new
            @wp_tt.term_taxonomy_id = tag.id
            @wp_tt.term_id = tag.id
            @wp_tt.taxonomy = "post_tag"
            @wp_tt.parent = 0
            @wp_tt.count = c
            @wp_tt.save
        end
        logger.info 'processing posts'
        for article in @articles
            c = Content.count(:all, :conditions=&gt;"article_id = #{article.id}")
            @wp_post = WpPost.new
            @wp_post.ID = article.id
            @wp_post.post_author = 1
            @wp_post.post_date = article.published_at-7.hours
            @wp_post.post_date_gmt = article.published_at
            @wp_post.post_content = article.body
            @wp_post.post_title = article.title
            @wp_post.post_category = 39
            @wp_post.post_status = "publish"
            @wp_post.post_status = "open"
            @wp_post.ping_status = "closed"
            @wp_post.post_name = article.permalink
            @wp_post.post_modified = article.updated_at-7.hours
            @wp_post.post_modified_gmt = article.updated_at
            @wp_post.post_parent = 0
            @wp_post.guid = article.published_at.strftime("http://blog.gillumiante.com/%Y/%m/%d/")+article.permalink
            @wp_post.menu_order = 0
            @wp_post.post_type = "post"
            @wp_post.comment_count = c
            @wp_post.save
        end
        logger.info 'processing comments'
                for comment in @comments
            @wp_com = WpComment.new
            @wp_com.comment_ID = comment.id
            @wp_com.comment_post_ID = comment.article_id
            @wp_com.comment_author = comment.author
            @wp_com.comment_author_email = comment.author_email
            if comment.author_url == nil
                comment.author_url = ""
            end
            @wp_com.comment_author_url = comment.author_url
            @wp_com.comment_author_IP = comment.author_ip
            @wp_com.comment_date = comment.published_at-7.hours
            @wp_com.comment_date_gmt = comment.published_at
            @wp_com.comment_content = comment.body
            @wp_com.comment_karma = 0
            @wp_com.comment_approved = '1'
            @wp_com.comment_parent = 0
            @wp_com.user_id = 0
            @wp_com.save
                end
        logger.info 'finished!'
        end_time = Time.now
        @lapsed = end_time-start_time
        render :layout=&gt;false
    end
end</pre>
<p>I then proceeded to visit the /mephisto/index page on my mephisto blog, which fired this baby off. It took all of about 9 seconds to complete.</p>
<p>I realize the irony of using Mephisto in order to abandon it. But in the end, I wasn&#8217;t switching from the Rails based app because of Rails, but because of the app. I am still in love with rails and as you can see, this project would have taken me a lot longer to accomplish had I attempted to write it in PHP, the language of WordPress.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gilluminate.com/2008/05/08/how-i-converted-mephisto-to-wordpress/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Mephisto to Typo migration?</title>
		<link>http://www.gilluminate.com/2007/12/29/mephisto-to-typo-migration/</link>
		<comments>http://www.gilluminate.com/2007/12/29/mephisto-to-typo-migration/#comments</comments>
		<pubDate>Sun, 30 Dec 2007 00:02:00 +0000</pubDate>
		<dc:creator>Jason Gill</dc:creator>
				<category><![CDATA[Developer Blog]]></category>
		<category><![CDATA[Mephisto]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[This Blog]]></category>

		<guid isPermaLink="false">http://blog.gillumiante.com/2007/12/30/mephisto-to-typo-migration</guid>
		<description><![CDATA[This blog you are reading is powered by Mephisto. I originally created this blog using my own code in PHP and was so tired of re-inventing the wheel that I went out and researched what I thought would be the best blogging software for my needs. I&#8217;m in love with Ruby on Rails, so one [...]]]></description>
			<content:encoded><![CDATA[<p>This blog you are reading is <a href="/2007/02/09/this-blog-now-running-mephisto-on-rails/">powered by Mephisto</a>. I originally created this blog using my own code in PHP and was so tired of re-inventing the wheel that I went out and researched what I thought would be the best blogging software for my needs. I&#8217;m in love with <a href="http://www.rubyonrails.org/">Ruby on Rails</a>, so one of my requirements was that it had to be using that technology. In my research I narrowed it down to <a href="http://www.typosphere.org/">Typo</a> and <a href="http://mephistoblog.com/">Mephisto</a>, but there wasn&#8217;t much activity over in the Typo camp and there were plenty of people blogging about their switch from Mephisto to Typo. So, I chose Mephisto thinking it was the better of the two.</p>
<p>I&#8217;ve since realized that Typo&#8217;s development activity has gone way up, and Mephisto&#8217;s has gone way down. I have been using Typo on another blog venture of mine and am in love with it. Actually, I&#8217;m loving it much more than Mephisto these days for several reasons, most of which pertain to user friendliness. I did run into an issue with trackback spam on Typo, which I&#8217;ve read as a <a href="http://sporkmonger.com/2007/1/12/blog-migration">big complaint</a> about it. But trackbacks aren&#8217;t even an option on Mephisto, so what&#8217;s the big deal?</p>
<p>The point I&#8217;m trying to make here is this. <strong>If there&#8217;s anyone out there with experience migrating from Mephisto to Typo I&#8217;d like to hear from you</strong>. There&#8217;s plenty of google hits about going from Typo to Mephisto, but nothing in the opposite direction. I&#8217;m interested in converting this blog, Tongue and Groove (once again).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gilluminate.com/2007/12/29/mephisto-to-typo-migration/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Start an RDoc Server for Ruby on Rails</title>
		<link>http://www.gilluminate.com/2007/09/11/how-to-start-an-rdoc-server-for-ruby-on-rails/</link>
		<comments>http://www.gilluminate.com/2007/09/11/how-to-start-an-rdoc-server-for-ruby-on-rails/#comments</comments>
		<pubDate>Tue, 11 Sep 2007 16:57:00 +0000</pubDate>
		<dc:creator>Jason Gill</dc:creator>
				<category><![CDATA[Developer Blog]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.gillumiante.com/2007/09/11/how-to-start-an-rdoc-server-for-ruby-on-rails</guid>
		<description><![CDATA[I don&#8217;t know why this is so poorly documented on the web. I guess everyone assumes that it&#8217;s so easy, that everyone knows it. Well, I forgot how and spent an hour on the web trying to find out how to start your own rdoc server. Here&#8217;s the command for anyone else who might be [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know why this is so poorly documented on the web. I guess everyone assumes that it&#8217;s so easy, that everyone knows it. Well, I forgot how and spent an hour on the web trying to find out how to start your own rdoc server. Here&#8217;s the command for anyone else who might be in my same boat:</p>
<pre>$ gem_server</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gilluminate.com/2007/09/11/how-to-start-an-rdoc-server-for-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>WestHost on Rails 2007 (for cheapskates)</title>
		<link>http://www.gilluminate.com/2007/07/24/westhost-on-rails-2007-for-cheapskates/</link>
		<comments>http://www.gilluminate.com/2007/07/24/westhost-on-rails-2007-for-cheapskates/#comments</comments>
		<pubDate>Tue, 24 Jul 2007 15:35:00 +0000</pubDate>
		<dc:creator>Jason Gill</dc:creator>
				<category><![CDATA[Developer Blog]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[WestHost]]></category>

		<guid isPermaLink="false">http://blog.gillumiante.com/2007/07/24/westhost-on-rails-2007-for-cheapskates</guid>
		<description><![CDATA[By Aaron Gustafson. Updated by Jason Gill While it is true that WestHost now offers Ruby on Rails, it&#8217;s only available on some of the packages and not all. If you are a cheapskate like me and want to add Ruby on Rails to the Personal Starter plan where RoR isn&#8217;t available, this tutorial is [...]]]></description>
			<content:encoded><![CDATA[<h3>By Aaron Gustafson. Updated by Jason Gill</h3>
<p>While it is true that <a href="http://affiliates.westhost.com/z/14/CD1084/">WestHost</a> now offers <a href="http://rubyonrails.org/">Ruby on Rails</a>, it&#8217;s only available on some of the packages and not all. If you are a cheapskate like me and want to add Ruby on Rails to the Personal Starter plan where RoR isn&#8217;t available, this tutorial is for you! This even works on packages that come with RoR for those of you who are unsatisfied with how limited WestHost&#8217;s install is. I&#8217;ve adapted <a href="http://www.easy-designs.net/articles/WesthostOnRails/">Aaron Gustafson&#8217;s tutorial</a> and updated it to be more relevant, more current, and (hopefully) more helpful for 2007.</p>
<p><strong>The Requisite Disclaimer:</strong> If you are on a different hosting company, I cannot guarantee this tutorial will work for you (though it may be helpful in figuring out your issues). As always, before you make changes to critical files (http.conf, .bashrc, etc.), do yourself a favor and make a backup copy; this tutorial offers assistance, but no warranty, so if you mess something up during the install, you&#8217;re on your own (but Westhost tech support should be helpful). Finally, this tutorial assumes some familiarity with the <em>Site Manager</em> from Westhost and some basic knowledge of the Linux shell. This tutorial uses <a href="http://en.wikipedia.org/wiki/Pico_(text_editor)">pico</a> as a text editor, but <a href="http://en.wikipedia.org/wiki/Vi">vi</a> is also an option and this tutorial assumes familiarity with inline text editors. I prefer <a href="http://en.wikipedia.org/wiki/Emacs">emacs</a>, but it&#8217;s not installed by default on WestHost servers.</p>
<p>Now that I&#8217;ve had to muddle through it a few times, I decided that, for my own sanity and to aid anyone else out there who may be going through the same thing, I would put together a comprehensive tutorial on how to install <a href="http://www.rubyonrails.com/">Ruby on Rails</a> at Westhost. The major problems that arise and could trip you up are</p>
<ol>
<li>Westhost now runs <a href="http://www.apache.org/">Apache 2.0</a></li>
<li><a href="http://www.fastcgi.com/">FastCGI</a> is not an option in some packages (and Rails will run incredibly slow without it), and</li>
<li>you cannot install applications in <em>/usr/bin</em>.</li>
</ol>
<p>This tutorial will get you up and running with a very simple Rails page on your Westhost VPS server using Apache 2.0 with FastCGI. For simplicity&#8217;s sake, I am going to set up the test Rails app on its own hostname (<em>demo.yoursitehere.com</em>).</p>
<h2>Required Site Applications</h2>
<p>Before we get started, log into your <em>Site Manager</em> (it can be found at <em>http://www.yoursitehere.com/manager</em>) and make sure the following are installed:</p>
<ul>
<li>MySQL 5.0.27 – because you&#8217;ll want a database</li>
<li>GNU Compiler Collection 1.0 – because we&#8217;ve got some compiling to do</li>
<li>Perl 5.8.8 – At present I can&#8217;t remember why, but I had problems without this installed.</li>
<li>FastCGI 2.4.0 (If available with your package).</li>
</ul>
<p>Now SSH into your site and we can get started.</p>
<h2>Step 1: Collect &amp; unpack</h2>
<p>First of all, make sure you are in your home directory</p>
<pre>[yourusername][~]$ cd /home/your_username</pre>
<p>or</p>
<pre>[yourusername][~]$ cd ~</pre>
<p>and then we can start the downloading and unpacking. First we get Ruby (the latest is 1.8.6 as of this writing), unpack it, and remove the archive:</p>
<pre>[yourusername][~]$ wget http://rubyforge.org/frs/download.php/18421/ruby-1.8.6.tar.gz
[yourusername][~]$ tar -xvzf ruby-1.8.6.tar.gz
[yourusername][~]$ rm -f ruby-1.8.6.tar.gz</pre>
<p>Next up is the latest Ruby Gem Manager (version 0.9.4 at present)</p>
<pre>[yourusername][~]$ wget http://rubyforge.org/frs/download.php/20989/rubygems-0.9.4.tgz
[yourusername][~]$ tar -xvzf rubygems-0.9.4.tgz
[yourusername][~]$ rm -f rubygems-0.9.4.tgz</pre>
<p>then the latest FastCGI Developer&#8217;s Kit (version 2.4.0 at present)</p>
<pre>[yourusername][~]$ wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
[yourusername][~]$ tar -xvzf fcgi-2.4.0.tar.gz
[yourusername][~]$ rm -f fcgi-2.4.0.tar.gz</pre>
<p>and, finally, the FastCGI module for Apache (version 2.4.2 at present)</p>
<pre>[yourusername][~]$ wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz
[yourusername][~]$ tar -xvzf mod_fastcgi-2.4.2.tar.gz
[yourusername][~]$ rm -f mod_fascgi-2.4.2.tar.gz</pre>
<h2>Step 2: Configure &amp; Install Ruby</h2>
<p>Starting in your home directory, get into the Ruby folder</p>
<pre>[yourusername][~]$ cd ruby-1.8.6</pre>
<p>We need to configure the source before we compile, letting it know that Ruby will be installed in <em>/usr/local/ruby</em> instead of <em>/usr/local</em>:</p>
<pre>[yourusername][ruby-1.8.6]$ ./configure --prefix=/usr/local/ruby</pre>
<p>Then go ahead and create the makefile and install Ruby.</p>
<pre>[yourusername][ruby-1.8.6]$ make &amp;&amp; make install</pre>
<p>If you get OpenSSL errors, you can compile without (assuming you don&#8217;t want to use ssl security):</p>
<pre>[yourusername][ruby-1.8.6]$ ./configure --prefix=/usr/local/ruby --without-openssl</pre>
<pre>[yourusername][ruby-1.8.6]$ make &amp;&amp; make install</pre>
<p>As we will be working with Ruby from the command line, we need it as part of our PATH, which means editing our .bashrc file:</p>
<pre>[yourusername][ruby-1.8.6]$ pico /.bashrc</pre>
<p>looking a few lines down from the top, you will see this line</p>
<pre>export PATH="$PATH:/usr/local/apache/bin"</pre>
<p>Change it to read</p>
<pre>export PATH="$PATH:/usr/local/apache/bin:/usr/local/ruby/bin"</pre>
<p>and save as you exit. Make sure your current session is using the new .bashrc file and then check your Ruby version (which will tell us if Ruby is working):</p>
<pre>[yourusername][ruby-1.8.6]$ source /.bashrc
[yourusername][~]$ ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]</pre>
<h2>Step 3: Installing Ruby Gem Manager</h2>
<p>We will be using the Ruby Gem Manager to install pretty much every other Ruby or Rails component we need, so it is next on our list. First of all, enter its folder</p>
<pre>[yourusername][~]$ cd rubygems-0.9.4</pre>
<p>and then install it using Ruby</p>
<pre>[yourusername][rubygems-0.9.4]$ ruby setup.rb</pre>
<p>give gem a test run</p>
<pre>[yourusername][rubygems-0.9.4]$ gem list</pre>
<p>We don&#8217;t have any gems installed yet (other than source), but that&#8217;s what we&#8217;re doing next.</p>
<h2>Step 4: Install Rails</h2>
<p>Now that we have the Gem Manager installed, the rest of the basic stuff is a snap. To install Rails, simply type the following</p>
<pre>[yourusername][rubygems-0.9.4]$ gem install rails --include-dependencies</pre>
<p>If you get the error &#8220;Could not find rails (&gt; 0) in any repository&#8221; you just need to run the following command:</p>
<pre>[yourusername][rubygems-0.9.4]$ rm -f /usr/local/ruby/lib/ruby/gems/1.8/source_cache</pre>
<p>now run</p>
<pre>[yourusername][rubygems-0.9.4]$ gem update</pre>
<p>and run the gem install command again.</p>
<pre>[yourusername][rubygems-0.9.4]$ gem install rails --include-dependencies</pre>
<p>This could take a little while, but should complete within a few minutes.</p>
<p>Now that we&#8217;ve done that, we can test our Rails install:</p>
<pre>[yourusername][rubygems-0.9.4]$ cd /var/www
[yourusername][www]$ rails demo
[yourusername][www]$ cd demo
[yourusername][demo]$ ruby script/server</pre>
<p>Open web browser to <em>http://www.yoursitehere.com:3000/</em> and look what you did. Congratulations, you&#8217;ve put Ruby on Rails!</p>
<h2>Step 5: Getting FastCGI up on Apache 2.0</h2>
<p><em>(If you have a hosting package from WestHost with FastCGI, you can just install it using the manager and skip step 5 altogether. Then again, if you have that package, you can probably install Rails from there also and you aren&#8217;t in need of this tutorial in the first place.)</em></p>
<p>OK, all of that stuff was pretty easy, but know things get just a little more complex. Be warned that it gets very tedious from here on in.</p>
<p>First off, return to your home directory:</p>
<pre>[yourusername][demo]$ cd ~</pre>
<p>We need to install the FastCGI Dev Kit. To do that, enter its directory, configure and install it similarly to how we did Ruby:</p>
<pre>[yourusername][~]$ cd fcgi-2.4.0
[yourusername][fcgi-2.4.0]$ ./configure --prefix=/usr/local/fcgi
[yourusername][fcgi-2.4.0]$ make &amp;&amp; make install</pre>
<p>Next on the agenda is getting Apache2 to understand FastCGI. To do this, we need to compile and install the DSO for Apache, which uses a slightly different process:</p>
<pre>[yourusername][fcgi-2.4.0]$ cd ../mod_fastcgi-2.4.2
[yourusername][mod_fastcgi-2.4.2]$ cp Makefile.AP2 Makefile
[yourusername][mod_fastcgi-2.4.2]$ make top_dir=/usr/lib/httpd
[yourusername][mod_fastcgi-2.4.2]$ make install top_dir=/usr/lib/httpd</pre>
<p>That put FastCGI in Apache&#8217;s modules directory, but not in the config file, so we&#8217;ll need to edit it.</p>
<pre>[yourusername][mod_fastcgi-2.4.2]$ pico /etc/httpd/conf/httpd.conf</pre>
<p>We need add the following in the list of already present modules</p>
<pre>LoadModule fastcgi_module   modules/mod_fastcgi.so</pre>
<p>Finally, create an instance of our demo app near the bottom of the httpd.conf file:</p>
<pre># FastCGI

FastCgiIpcDir /tmp/fcgi_ipc
FastCgiServer /var/www/demo/public/dispatch.fcgi -processes 1 -idle-timeout 60</pre>
<p><strong>Processes:</strong> Why only one process? Well, 1 is usually enough for most applications. If you are getting <em>really heavy</em> traffic, you could bump it up to 2, but FastCGI can be a bit resource hungry. It is even worse if you run multiple FastCGI servers on a single box. For instance, according to a tech at WestHost, 4 server instances running a large number of processes (say 15) each will frequently cause over 400MB of RAM and 1GB of swap to be used on the server, resulting in the cyclic behavior of freeing and reallocating memory. This is <em>very</em> resource intensive and it causes the server&#8217;s load to spike, which is problematic for any other users on the same server (in a VPS situation).</p>
<h2>Step 6: Configuration</h2>
<p>Go into <em>Domain Management</em>, set up a new Sub Domain Name: for your domain using the following values:</p>
<ul>
<li>Sub Domain Name:: <em>demo</em></li>
<li>Root directory for the new sub domain will be: <em>/var/www/demo</em></li>
</ul>
<p>Now configure your virtual host so that</p>
<pre>ServerName demo.mysite.com
ServerAlias www.demo.mysite.com
DocumentRoot /var/www/demo/</pre>
<p>becomes</p>
<pre>ServerName demo.mysite.com
ServerAlias www.demo.mysite.com
DocumentRoot /var/www/demo/public/
ErrorLog /var/www/demo/log/server.log

Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny</pre>
<p>Save the file as you exit and then test it to make sure you didn&#8217;t screw anything up before restarting Apache:</p>
<pre>[yourusername][mod_fastcgi-2.4.2]$ apachectl configtest
Syntax OK
[yourusername][mod_fastcgi-2.4.2]$ apachectl restart</pre>
<p>Hang in there, we&#8217;re almost done. To set up Rails to use FastCGI, we need to edit the .htaccess file in your public folder:</p>
<pre>[yourusername][mod_fastcgi-2.4.2]$ pico /var/www/demo/public/.htaccess</pre>
<p>In that file, change</p>
<pre>RewriteRule ^(.*)$ dispatch.cgi [QSA,L]</pre>
<p>to read</p>
<pre>RewriteRule ^(.*)$ &lt;strong&gt;dispatch.fcgi&lt;/strong&gt; [QSA,L]</pre>
<p>Then save when you exit.</p>
<p>Finally, we need to set up the Ruby-FastCGI Gem</p>
<pre>[yourusername][mod_fastcgi-2.4.2]$ gem install fcgi --with-fcgi-dir=/usr/local/fcgi</pre>
<h2>Step 7: Let&#8217;s get rolling</h2>
<p>Finally we are in a position to test our install. To do so, we&#8217;ll add a simple controller to our demo Rails install. We start by moving into the demo folder</p>
<pre>[yourusername][mod_fastcgi-2.4.2]$ cd /var/www/demo</pre>
<p>and then we use the Generator to make us a controller:</p>
<pre>[yourusername][demo]$ ruby script/generate controller Say</pre>
<p>That doesn&#8217;t do a whole lot since we have no actions. Let&#8217;s define an empty one:</p>
<pre>[yourusername][demo]$ pico app/controllers/say_controller.rb</pre>
<p>Edit the file to read</p>
<pre>class SayController &lt; ApplicationController
def hello
end
end</pre>
<p>and save as you exit.</p>
<p>Now that&#8217;s all well and good, but we get an error if we try to surf to <em>http://demo.yoursitehere.com/say/hello</em> because there is no view associated with it. That&#8217;s easy enough to remedy, we&#8217;ll create one.</p>
<pre>[yourusername][demo]$ pico app/views/say/hello.rhtml</pre>
<p>Type out something simple, such as</p>
<pre>Hello World</pre>
<h1>Hello from Rails!</h1>
<p>The current time is</p>
<p>and then revisit <em>http://demo.yoursitehere.com/say/hello</em>. Now you&#8217;re rolling. Good luck and enjoy.</p>
<h2>Step 8 : What? You want MySQL?</h2>
<p>Okay, so you want to hook up Rails to your MySQL database now. To do this, there&#8217;s a few hoops you need to jump though. First of all, you&#8217;ll need to edit your database configuration file.</p>
<pre>[yourusername][demo]$ pico config/database.yml</pre>
<p>Fill in your database names for the development, test and production environments and the username and password for each. Then add the socket path:</p>
<pre>development:

adapter: mysql
socket: /var/lib/mysql/mysql.sock
database: your_development_db
host: localhost
username: root
password: your_password

# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.

test:

adapter: mysql
socket: /var/lib/mysql/mysql.sock
database: your_test_db
host: localhost
username: root
password: your_password

production:

adapter: mysql
socket: /var/lib/mysql/mysql.sock
database: your_production_db
host: localhost
username: root
password: your_password</pre>
<p>and save as you exit. Without the socket information, Rails will never find MySQL, which sucks.</p>
<p>(This information licensed under a <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons</a> License.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gilluminate.com/2007/07/24/westhost-on-rails-2007-for-cheapskates/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Best Way to do Multiple Select Combo Boxes in Rails</title>
		<link>http://www.gilluminate.com/2007/02/15/best-way-to-do-multiple-select-combo-boxes-in-rails/</link>
		<comments>http://www.gilluminate.com/2007/02/15/best-way-to-do-multiple-select-combo-boxes-in-rails/#comments</comments>
		<pubDate>Thu, 15 Feb 2007 23:16:00 +0000</pubDate>
		<dc:creator>Jason Gill</dc:creator>
				<category><![CDATA[Developer Blog]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.gillumiante.com/2007/02/15/best-way-to-do-multiple-select-combo-boxes-in-rails</guid>
		<description><![CDATA[After much trial and error, and frustration, I have finally come up with what I believe is the best possible way to do multiple select combo boxes in Rails. It&#8217;s not so much that there aren&#8217;t examples on the web, it&#8217;s just that every example is so different. I&#8217;ve used what I feel is the [...]]]></description>
			<content:encoded><![CDATA[<p>After much trial and error, and frustration, I have finally come up with what I believe is the <strong>best</strong>  possible way to do multiple select combo boxes in Rails. It&#8217;s not so much that there aren&#8217;t examples on the web, it&#8217;s just that every example is so different. I&#8217;ve used what I feel is the best from each example and created this example.</p>
<p>First, it&#8217;s best that the <em>options</em> are in an array somewhere. In this example, we&#8217;ll assume that all states are set in an array on the application.rb and the array is named $states</p>
<p>In the _form, or wherever your form is, do the following:</p>
<pre>&lt;% if @model_name and @model_name.states
@states_selected = @model_name.states.collect
end %&gt;
&lt;label for="model_name_states"&gt;State&lt;/label&gt;&lt;br/&gt;
&lt;%= select_tag 'model_name[states][]', options_for_select($states, @states_selected), { :multiple =&gt; true, :size =&gt;5, :id =&gt; "model_name_states" } %&gt;&lt;/p&gt;</pre>
<p>This will not only dynamically create your <em>select</em> field with each <em>option</em>, but it will make it so that if someone leaves off a required field the same selected states will be selected on the <em>edit</em> screen!</p>
<p>See the Rails documentation for <code>options_for_select</code> to customize it even further. Obviously you can leave off the <code>:multiple</code> and <code>:size</code> to make it a single select with similar results, but it&#8217;s better to use <code>select</code>  instead of <code>select_tag</code> for single select combo boxes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gilluminate.com/2007/02/15/best-way-to-do-multiple-select-combo-boxes-in-rails/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>RubyWeaver is alive!</title>
		<link>http://www.gilluminate.com/2007/02/14/rubyweaver-is-alive/</link>
		<comments>http://www.gilluminate.com/2007/02/14/rubyweaver-is-alive/#comments</comments>
		<pubDate>Wed, 14 Feb 2007 17:14:00 +0000</pubDate>
		<dc:creator>Jason Gill</dc:creator>
				<category><![CDATA[Developer Blog]]></category>
		<category><![CDATA[Dreamweaver]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.gillumiante.com/2007/02/14/rubyweaver-is-alive</guid>
		<description><![CDATA[RubyWeaver is an IDE for Ruby and Rails in Dreamweaver. This extension originally came from RidingTheClutch.com which seems to have mysteriously disappeared, along with it&#8217;s original author Rob Cameron whom I have tried to contact with regards to RubyWeaver, but with no avail. I&#8217;ve taken the liberty to make this extension available once again to [...]]]></description>
			<content:encoded><![CDATA[<p>RubyWeaver is an IDE for Ruby and Rails in Dreamweaver. This extension originally came from <a href="http://www.ridingtheclutch.com/entry.cfm?id=59">RidingTheClutch.com</a> which seems to have mysteriously disappeared, along with it&#8217;s original author <a href="mailto:rob@ridingtheclutch.com">Rob Cameron</a> whom I have tried to contact with regards to RubyWeaver, but with no avail. I&#8217;ve taken the liberty to make this extension available once again to those who are looking for it, which I believe to be many. Since Macromedia (Adobe) makes it very easy to retrieve the source code for an extension once it is installed, I&#8217;ve also taken the liberty of upgrading it a bit, since I have built a <a href="http://velocity.gilluminate.com/">dreamweaver extension</a> similar to this one before and thought everyone could benefit from the enhancements.</p>
<p>If you do any Ruby on Rails and want to use it with Dreamweaver, <a href="http://rubyweaver.gilluminate.com/">Download RubyWeaver 2.0</a> today!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gilluminate.com/2007/02/14/rubyweaver-is-alive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This blog now running Mephisto on Rails</title>
		<link>http://www.gilluminate.com/2007/02/09/this-blog-now-running-mephisto-on-rails/</link>
		<comments>http://www.gilluminate.com/2007/02/09/this-blog-now-running-mephisto-on-rails/#comments</comments>
		<pubDate>Sat, 10 Feb 2007 06:01:00 +0000</pubDate>
		<dc:creator>Jason Gill</dc:creator>
				<category><![CDATA[Developer Blog]]></category>
		<category><![CDATA[Akismet]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[Mephisto]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[This Blog]]></category>

		<guid isPermaLink="false">http://blog.gillumiante.com/2007/02/10/this-blog-now-running-mephisto-on-rails</guid>
		<description><![CDATA[I finally made the switch! I&#8217;ve been working on migrating this old blog to Mephisto blogging system. Mephisto runs on Rails which I have blogged about before and still continue to love and swear by. The old blog I wrote in PHP a few years ago. I was just getting sick of re-inventing the wheel [...]]]></description>
			<content:encoded><![CDATA[<p>I finally made the switch!</p>
<p>I&#8217;ve been working on migrating this old blog to <a href="http://mephistoblog.com/">Mephisto</a> blogging system. Mephisto runs on <a href="http://www.rubyonrails.org/">Rails</a> which I have blogged about <a href="/tag/ruby-on-rails/">before</a> and still continue to love and swear by.</p>
<p>The old blog I wrote in PHP a few years ago. I was just getting sick of re-inventing the wheel every time I wanted to add and maintain a new feature. I wanted a new system that I didn&#8217;t have to build and maintain so that I could focus more on the actual content. Mephisto also allows you to use <a href="http://akismet.com/">Akismet</a> for spam defense. Akismet is typically used with <a href="http://wordpress.com/api-keys/">WordPress</a> and does a great job of keeping comment spam out of your blog. I was spending <em>way</em> too much time removing spam from the old blog, so Akismet is a welcome change!</p>
<p>Also, for the sake of time, I decided to download a <a href="http://themes.benlog.org/">theme for Mephisto</a> rather than design one myself. I chose the Lucid theme which is actually a port of the Lucid Typo theme (Typo is another Rails based blogging system). I have tweaked the default theme quite a bit to be better suited for <abbr title="Search Engine Optimization">SEO</abbr> as well as handle my google ads. I also changed the default color from Ruby to Mint. But if you like the Ruby better you can change it in the upper right corner. You can also change the layout from static to liquid. These options are a few of the reasons I chose the Lucid theme.</p>
<p>Last but not least, I&#8217;ve finally made the transition from using <a href="http://www.mrunix.net/webalizer/">Webalizer</a> as my tracking software, to using <a href="http://www.google.com/analytics/">Google Analytics</a> instead. Google Analytics is a robust tracking application that is comparable to expensive tracking apps like <a href="http://www.omniture.com/">Omniture</a> but is offered as a <em>free</em> service. I&#8217;m extremely impressed with Google Analytics&#8217; capabilities and how easy it is to implement. I&#8217;d recommend it for any website, big or small!</p>
<p>Let me know what you think of the new do.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gilluminate.com/2007/02/09/this-blog-now-running-mephisto-on-rails/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

