<?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>Shaun Ambrose &#187; Ruby on Rails</title>
	<atom:link href="http://www.shaunambrose.com/category/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shaunambrose.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 10 Jan 2012 01:39:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to install gems without documentation by default</title>
		<link>http://www.shaunambrose.com/2011/10/24/how-to-install-gems-without-documentation-by-default/</link>
		<comments>http://www.shaunambrose.com/2011/10/24/how-to-install-gems-without-documentation-by-default/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 18:18:11 +0000</pubDate>
		<dc:creator>Shaun</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[how to]]></category>

		<guid isPermaLink="false">http://www.shaunambrose.com/?p=609</guid>
		<description><![CDATA[Here&#8217;s a quick tip I learned this weekend on how to get all your RubyGems installed without documentation by default. I knew there was a way to prevent documentation from being installed at the command line with the &#8211;no-rdoc &#8211;no-ri options: $ gem install rails --no-rdoc --no-ri But there&#8217;s another way to prevent documentation from [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick tip I learned this weekend on how to get all your RubyGems installed without documentation by default.<br />
<span id="more-609"></span><br />
I knew there was a way to prevent documentation from being installed at the command line with the &#8211;no-rdoc &#8211;no-ri options:</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">$ gem install rails --no-rdoc --no-ri</pre></div></div>

<p>But there&#8217;s another way to prevent documentation from being installed. Create a .gemrc file in your home directory with the following:</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">gem: --no-ri --no-rdoc</pre></div></div>

<p>Now you don&#8217;t have to worry about supplying the command line options, this will give you no documentation by default.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunambrose.com/2011/10/24/how-to-install-gems-without-documentation-by-default/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting VIM setup for Ruby on Rails</title>
		<link>http://www.shaunambrose.com/2011/10/03/getting-vim-setup-for-ruby-on-rails/</link>
		<comments>http://www.shaunambrose.com/2011/10/03/getting-vim-setup-for-ruby-on-rails/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 03:39:31 +0000</pubDate>
		<dc:creator>Shaun</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.shaunambrose.com/?p=552</guid>
		<description><![CDATA[I just got started using Vim for Ruby on Rails development. Here are some of my notes on how I got started. Please note that this is more of a (rough) guide on how to get Vim setup for Ruby on Rails than it is how to use it. Get Vim First, download/install your flavor [...]]]></description>
			<content:encoded><![CDATA[<p>I just got started using Vim for Ruby on Rails development. Here are some of my notes on how I got started. Please note that this is more of a (rough) guide on how to get Vim setup for Ruby on Rails than it is how to use it.<br />
<span id="more-552"></span></p>
<h3>Get Vim</h3>
<p>First, download/install your flavor of Vim: <a href="http://www.vim.org/download.php">http://www.vim.org/download.php</a></p>
<h3>Create a vimrc file</h3>
<p>Now, before you start editing any files, you&#8217;ll probably want to do some customizations first.</p>
<p>Create a vimrc file: <a href="http://vim.wikia.com/wiki/Open_vimrc_file">http://vim.wikia.com/wiki/Open_vimrc_file</a></p>
<p>In your vimrc you&#8217;ll want to add some basic settings such as the ones below:</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #adadad; font-style: italic;">&quot; The set nocompatible setting makes vim behave in a more useful way</span>
<span style="color: #804040;">set</span> <span style="color: #668080;">nocompatible</span><span style="color: #adadad; font-style: italic;">
&nbsp;
&quot; Enable filetype-specific indenting and plugins</span>
<span style="color: #804040;">filetype</span> <span style="color: #25BB4D;">plugin</span> <span style="color: #25BB4D;">indent</span> <span style="color: #25BB4D;">on</span><span style="color: #adadad; font-style: italic;">
&nbsp;
&quot; Turn syntax highlighting on</span>
<span style="color: #804040;">syntax</span> <span style="color: #25BB4D;">on</span><span style="color: #adadad; font-style: italic;">
&nbsp;
&quot; Highlight search results</span>
<span style="color: #804040;">set</span> <span style="color: #668080;">hlsearch</span><span style="color: #adadad; font-style: italic;">
&nbsp;
&quot; Turn on line numbering</span>
<span style="color: #804040;">set</span> <span style="color: #668080;">number</span><span style="color: #adadad; font-style: italic;">
&nbsp;
&quot; Make backspce behave more normally</span>
<span style="color: #804040;">set</span> <span style="color: #668080;">backspace</span>=<span style="color: #25BB4D;">indent</span>,<span style="color: #668080;">eol</span>,start<span style="color: #adadad; font-style: italic;">
&nbsp;
&quot; Turn on automatic indenting</span>
<span style="color: #804040;">set</span> <span style="color: #668080;">smartindent</span><span style="color: #adadad; font-style: italic;">
&nbsp;
&quot; Insert space characters whenever the tab key is pressed</span>
<span style="color: #804040;">set</span> <span style="color: #668080;">expandtab</span><span style="color: #adadad; font-style: italic;">
&nbsp;
&quot; Set tabs</span>
<span style="color: #804040;">set</span> <span style="color: #668080;">tabstop</span>=<span style="color: #000000; font-weight:bold;">2</span>
<span style="color: #804040;">set</span> <span style="color: #668080;">shiftwidth</span>=<span style="color: #000000; font-weight:bold;">2</span></pre></div></div>

<h3>Create Vim sub-folders</h3>
<p>Inside your .vim (vimfiles on Windows) folder, create some sub-folders for plug-ins and color schemes:</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;"><span style="color: #b1b100; font-weight: bold;">mkdir</span> -p ~/.vim/autoload
<span style="color: #b1b100; font-weight: bold;">mkdir</span> -p  ~/.vim/bundle
<span style="color: #b1b100; font-weight: bold;">mkdir</span> -p  ~/.vim/colors</pre></div></div>

<h3>Set a default color scheme and font</h3>
<p>After you have your vimrc file, you can customize the look-and-feel of Vim by picking a default color scheme and font.</p>
<p>Here are some good color themes I have found:</p>
<ul>
<li><strong>jellybeans:</strong> <a href="http://www.vim.org/scripts/script.php?script_id=2555">http://www.vim.org/scripts/script.php?script_id=2555</a></li>
<li><strong>railscasts:</strong> <a href="http://www.vim.org/scripts/script.php?script_id=2175">http://www.vim.org/scripts/script.php?script_id=2175</a></li>
<li><strong>vividchalk:</strong> <a href="http://www.vim.org/scripts/script.php?script_id=1891">http://www.vim.org/scripts/script.php?script_id=1891</a></li>
</ul>
<p>The color theme files go in ~/.vim/colors or ~\vimfiles\colors if you&#8217;re on Windows. Then you in your vimrc file you can set your default color scheme:</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #adadad; font-style: italic;">&quot; Set default color scheme</span>
<span style="color: #804040;">colorscheme</span> jellybeans</pre></div></div>

<p>It&#8217;s also nice  to have a good programming font in Vim. Here&#8217;s a list of preferred fonts and also how to set a default font in your vimrc file:</p>
<p><a href="http://stackoverflow.com/questions/485174/programming-fonts">http://stackoverflow.com/questions/485174/programming-fonts</a><br />
<a href="http://vim.wikia.com/wiki/Change_font">http://vim.wikia.com/wiki/Change_font</a></p>
<h3>Install plug-ins</h3>
<p>Next, it&#8217;s time to install some plug-ins. Here are some good ones that I have found:</p>
<ul>
<li><a href="https://github.com/tpope/vim-pathogen">https://github.com/tpope/vim-pathogen</a></li>
<li><a href="https://github.com/tpope/vim-rails">https://github.com/tpope/vim-rails</a></li>
<li><a href="https://github.com/tpope/vim-endwise">https://github.com/tpope/vim-endwise</a></li>
<li><a href="https://github.com/tpope/vim-fugitive">https://github.com/tpope/vim-fugitive</a></li>
<li><a href="https://github.com/scrooloose/nerdtree">https://github.com/scrooloose/nerdtree</a></li>
</ul>
<p>I&#8217;m using pathogen to manage my Vim plug-ins, so after that&#8217;s installed, to install a new plug-in, you just navigate to your: ~/.vim/bundle (~\vimfiles\bundle on Windows) directory and run git clone commands to install the new plug-ins:</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">git clone git://github.com/tpope/vim-rails.git
git clone git://github.com/tpope/vim-endwise.git
git clone https://github.com/scrooloose/nerdtree.git
git clone git://github.com/tpope/vim-fugitive.git</pre></div></div>

<h3>Summary</h3>
<p>That&#8217;s my rough guide on setting up Vim for Ruby on Rails development. Like I said I just got start using Vim for Ruby on Rails myself, so I know there&#8217;s a lot of plug-ins and settings I haven&#8217;t discovered yet.</p>
<p>Here are some links to the resources I used to setup Vim for Ruby on Rails and also how I&#8217;ve been learning how to learn Git:</p>
<ul>
<li><a href="http://www.derekwyatt.org/vim/vim-tutorial-videos/vim-novice-tutorial-videos/">http://www.derekwyatt.org/vim/vim-tutorial-videos/vim-novice-tutorial-videos/</a></li>
<li>http://oldwiki.rubyonrails.org/rails/pages/HowtoUseVimWithRails</li>
<li><a href="http://net.tutsplus.com/sessions/vim-essential-plugins/">http://net.tutsplus.com/sessions/vim-essential-plugins/</a></li>
<li><a href="http://vimcasts.org/">http://vimcasts.org/</a></li>
<li><a href="http://blog.interlinked.org/tutorials/vim_tutorial.html">http://blog.interlinked.org/tutorials/vim_tutorial.html</a></li>
</ul>
<p>Also, the vimtutor command line program and <a href="http://www.amazon.com/Learning-Vim-Editors-Arnold-Robbins/dp/059652983X">O&#8217;Reilly Vim book</a> came in handy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunambrose.com/2011/10/03/getting-vim-setup-for-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Tip: Methods in Ruby</title>
		<link>http://www.shaunambrose.com/2011/08/18/quick-tip-methods-in-ruby/</link>
		<comments>http://www.shaunambrose.com/2011/08/18/quick-tip-methods-in-ruby/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 05:29:05 +0000</pubDate>
		<dc:creator>Shaun</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.shaunambrose.com/?p=548</guid>
		<description><![CDATA[Here are some quick tips to keep in mind when coding new methods in Ruby. Each method should be short and focused on doing one thing. Each method should be well named, the method name should reflect what the method does. Each method should operate at a single conceptual level. Methods shouldn&#8217;t be doing both [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some quick tips to keep in mind when coding new methods in Ruby.<br />
<span id="more-548"></span></p>
<li>Each method should be short and focused on doing one thing.</li>
<li>Each method should be well named, the method name should reflect what the method does.</li>
<li>Each method should operate at a single conceptual level. Methods shouldn&#8217;t be doing both low level logic and high level logic.</li>
<p>I&#8217;ve learned that keeping your Ruby methods well named, short and focused makes them easier to read and also easier to test.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunambrose.com/2011/08/18/quick-tip-methods-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Tip: How to use unless in Ruby</title>
		<link>http://www.shaunambrose.com/2011/04/22/quick-tip-how-to-use-unless-in-ruby/</link>
		<comments>http://www.shaunambrose.com/2011/04/22/quick-tip-how-to-use-unless-in-ruby/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 21:44:14 +0000</pubDate>
		<dc:creator>Shaun</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[how to]]></category>

		<guid isPermaLink="false">http://www.shaunambrose.com/?p=531</guid>
		<description><![CDATA[Unless is a backwards if in Ruby. For the longest time I had a hard time wrapping my head around using it instead of just using not if, which I&#8217;ve always been used to. But, if you want to be apart of the Ruby culture, you need to learn how to use unless, here&#8217;s my [...]]]></description>
			<content:encoded><![CDATA[<p><em>Unless</em> is a backwards <em>if</em> in Ruby. For the longest time I had a hard time wrapping my head around using it instead of just using <em>not if</em>, which I&#8217;ve always been used to. But, if you want to be apart of the Ruby culture, you need to learn how to use <em>unless</em>, here&#8217;s my simple technique on how I learned to use it.<br />
<span id="more-531"></span><br />
When I first started using <em>unless</em>, I just translated it (in my mind) with the dictionary definition: except on the condition that. You can even shorten the translation to: except if. Once I did this, reading and using <em>unless</em> made more sense to me.</p>
<p>Example:</p>
<pre>
<code>messages.delete('twitter') unless user.twitter_username</code>
</pre>
<p>Using the translation, this Ruby code would read as: delete twitter messages except if the user has a twitter username.</p>
<p>Using and reading <em>unless</em> in Ruby was like Greek to me when I first saw it, but now that my brain automatically makes the association/translation for me, using it has become second nature.</p>
<p>Hopefully this technique will help someone else struggling to use <em>unless</em> in Ruby.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunambrose.com/2011/04/22/quick-tip-how-to-use-unless-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to fix the &#8220;msvcrt-ruby18.dll is missing from your computer&#8221; error message in Ruby on Rails</title>
		<link>http://www.shaunambrose.com/2010/11/11/how-to-fix-the-msvcrt-ruby18-dll-is-missing-from-your-computer-error-message-in-ruby-on-rails/</link>
		<comments>http://www.shaunambrose.com/2010/11/11/how-to-fix-the-msvcrt-ruby18-dll-is-missing-from-your-computer-error-message-in-ruby-on-rails/#comments</comments>
		<pubDate>Thu, 11 Nov 2010 19:09:30 +0000</pubDate>
		<dc:creator>Shaun</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.shaunambrose.com/?p=465</guid>
		<description><![CDATA[Here&#8217;s how to fix that annoying Ruby on Rails popup message: &#8220;The program can&#8217;t start because msvcrt-ruby18.dll is missing from your computer. Try reinstalling the program to fix this problem.&#8221; This fix applies if you&#8217;re using cucumber on Windows. It turns out the error message is related to the json gem that cucumber depends on. [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s how to fix that annoying Ruby on Rails popup message: &#8220;The program can&#8217;t start because msvcrt-ruby18.dll is missing from your computer. Try reinstalling the program to fix this problem.&#8221;</p>
<p>This fix applies if you&#8217;re using cucumber on Windows.<br />
<span id="more-465"></span><br />
It turns out the error message is related to the json gem that cucumber depends on. The details and solution are buried in this <a href="http://groups.google.com/group/rubyinstaller/browse_thread/thread/7f96baf7e80d30d8/3145b2ea94697e44">thread</a>.</p>
<p>To fix it, you just have to run:</p>
<pre>
<code>
gem uninstall json</code></pre>
<p>followed by:</p>
<pre>
<code>
gem install json --platform=ruby
</pre>
<p></code></p>
<p>Notes:<br />
You need to have DevKit installed for this fix: <a href="https://github.com/oneclick/rubyinstaller/wiki/Development-Kit">https://github.com/oneclick/rubyinstaller/wiki/Development-Kit</a></p>
<p>If you get an error when installing the new json gem, make sure a rails server or console isn't running in the background.</p>
<p>The offending version of json for me was 1.4.6-x86-mingw32, so you need to uninstall and install that version: gem install json --version=1.4.6 --platform=ruby</p>
<p>If you install new gems after you make this fix, the error message will pop-up again, so you'll have to uninstall/install the json gem again. If anyone knows a way around this, please let me know.</p>
<p>Anyway, I hope this fix is helpful, that error was driving me nuts!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunambrose.com/2010/11/11/how-to-fix-the-msvcrt-ruby18-dll-is-missing-from-your-computer-error-message-in-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>How to fix a “sqlite3.dll missing” error message in Ruby on Rails</title>
		<link>http://www.shaunambrose.com/2010/08/05/how-to-fix-a-sqlite3-dll-missing-error-message-in-ruby-on-rails/</link>
		<comments>http://www.shaunambrose.com/2010/08/05/how-to-fix-a-sqlite3-dll-missing-error-message-in-ruby-on-rails/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 20:10:35 +0000</pubDate>
		<dc:creator>Shaun</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[how to]]></category>

		<guid isPermaLink="false">http://www.shaunambrose.com/?p=433</guid>
		<description><![CDATA[Here&#8217;s a little reminder for myself on how I fixed the &#8220;sqlite3.dll missing&#8221; error message I was getting while setting up a new Ruby on Rails environment. First, I downloaded the latest SQlite3 DLL. (I grabbed the DLL of the SQLite library without the TCL bindings.) Then, I exracted the .dll and .def files to [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a little reminder for myself on how I fixed the &#8220;sqlite3.dll missing&#8221; error message I was getting while setting up a new Ruby on Rails environment.<br />
<span id="more-433"></span></p>
<p>First, I downloaded the latest <a href="http://www.sqlite.org/download.html">SQlite3 DLL.</a> (I grabbed the DLL of the SQLite library without the TCL bindings.)</p>
<p>Then, I exracted the .dll and .def files to my C:\ruby\bin directory and that fixed my issue. (You&#8217;ll might have to restart your console session.) </p>
<p>These steps will also fix this error message:<br />
&#8220;The procedure entry point sqlite3_column_database_name could not be located in the dynamic link library sqlite3.dll.&#8221;</p>
<p>Hope this helps someone else running into the same issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunambrose.com/2010/08/05/how-to-fix-a-sqlite3-dll-missing-error-message-in-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>How to create migrations in Ruby on Rails that only run in the development enviroment</title>
		<link>http://www.shaunambrose.com/2010/02/13/how-to-create-migrations-in-ruby-on-rails-that-only-run-in-the-development-enviroment/</link>
		<comments>http://www.shaunambrose.com/2010/02/13/how-to-create-migrations-in-ruby-on-rails-that-only-run-in-the-development-enviroment/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 06:52:17 +0000</pubDate>
		<dc:creator>Shaun</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[how to]]></category>

		<guid isPermaLink="false">http://www.shaunambrose.com/?p=371</guid>
		<description><![CDATA[This is a reminder for myself for when I want to use a migration to create test data for the development environment only. I thought it would be as easy as using the environment variable ENV['RAILS_ENV'] in the migration to see which environment you&#8217;re in, but this doesn&#8217;t work. After a little searching, it is [...]]]></description>
			<content:encoded><![CDATA[<p>This is a reminder for myself for when I want to use a migration to create test data for the development environment only.<br />
<span id="more-371"></span><br />
I thought it would be as easy as using the environment variable <strong>ENV['RAILS_ENV']</strong> in the migration to see which environment you&#8217;re in, but this doesn&#8217;t work. After a little searching, it is as easy as I thought; you just have to use the constant <strong>RAILS_ENV</strong>. So, your migration would look something like this:</p>
<pre><code>
def self.up
  if RAILS_ENV == 'development'
    # set all of your test data for development...
  end
end
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunambrose.com/2010/02/13/how-to-create-migrations-in-ruby-on-rails-that-only-run-in-the-development-enviroment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

