<?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>Ivan Enviroman &#187; rails</title>
	<atom:link href="http://www.ivanenviroman.com/tag/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ivanenviroman.com</link>
	<description>Sustainability, Business, Technology, and Spirit</description>
	<lastBuildDate>Sat, 04 Sep 2010 03:05:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>The Simplest Possible Cucumber Test</title>
		<link>http://www.ivanenviroman.com/test-post/</link>
		<comments>http://www.ivanenviroman.com/test-post/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 21:15:59 +0000</pubDate>
		<dc:creator>ivanoats</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[webdesign]]></category>
		<category><![CDATA[webdevelopment]]></category>

		<guid isPermaLink="false">http://www.ivanenviroman.com/?p=1656</guid>
		<description><![CDATA[I&#8217;m not really that good at testing. So what, so are a lot of people. Having some tests is better than none! And, the way testing tutorials are written can seem really complex and scary. Today I started thinking about &#8230; <a href="http://www.ivanenviroman.com/test-post/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not really that good at testing. So what, so are a lot of people. Having some tests is better than none! And, the way testing tutorials are written can seem really complex and scary. Today I started thinking about the simplest possible way to get started with web app testing.</p>
<p>When I&#8217;m getting back into a project after not working on it for a while, I just want to know whether the application works. I want to know whether it will run on my development environment, even if I&#8217;m on a new machine. I have three computers that I use at various locations so this is important to me.</p>
<p>So for me the simplest possible test would be:</p>
<ul>
<li>The home page should load. That is the default route should return a successful page without any errors. It will have some key piece of text that says it&#8217;s working.</li>
</ul>
<p>Here&#8217;s how I do it with <a href="http://www.cukes.info/">cucumber</a>:</p>
<p>If you haven&#8217;t installed the cucumber gems yet, put this in your <code>config/test.rb</code>file.
</p>
<p>If you haven&#8217;t cucumber set up yet, run
<pre class="brush: php">script/generate cucumber</pre>
</p>
<p>Then, create the file below:</p>
<p>File: features/homepage.feature</p>
<pre class="brush: ruby">
Feature: View homepage for app
  In order to make sure the app loads
  As a user
  I want to see the home page

Scenario: Homepage should say Search
  When I go to the homepage
  Then I should see &quot;Search&quot;
</pre>
<p>Tip: none of what you write in the Feature section really matters. It&#8217;s just for you or your client&#8217;s benefit.</p>
<p>Then, run
<pre class="brush: php">cucumber features</pre>
</p>
<p>You should get the following output:</p>
<pre class="brush: ruby">
:&gt; cucumber features
Feature: View homepage for app
  In order to make sure the app loads
  As a user
  I want to see the home page

  Scenario: Homepage should say Search # features/homepage.feature:6
    When I go to the homepage          # features/step_definitions/webrat_steps.rb:10
    Then I should see &quot;My Telltale Text&quot; # features/step_definitions/webrat_steps.rb:118

1 scenario (1 passed)
2 steps (2 passed)
</pre>
</p>
<p>Some cool things about this: &#8220;the homepage&#8221; is something that cucumber / webrat understands out of the box. See features/step_definitions/webrat_steps.rb for how to define other custom route names. And also, &#8220;I should see &#8220;something in quotes&#8221; is out of the box cucumber goodness.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ivanenviroman.com/test-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails Rescue Handbook, an ebook by Mike Gunderloy</title>
		<link>http://www.ivanenviroman.com/rails-rescue-handbook-an-ebook-by-mike-gunderloy/</link>
		<comments>http://www.ivanenviroman.com/rails-rescue-handbook-an-ebook-by-mike-gunderloy/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 17:34:28 +0000</pubDate>
		<dc:creator>ivanoats</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[railsbooks]]></category>

		<guid isPermaLink="false">http://delicious.com/url/1dba3c04b62a2237719ee73a1ac0f43a#ivanoats</guid>
		<description><![CDATA[Rails is a powerful development tool for web applications - but that power can lead inexperienced developers astray. If you&#39;re working on a Rails project gone bad, the targeted advice in this ebook will get you back on track quickly. <a href="http://www.ivanenviroman.com/rails-rescue-handbook-an-ebook-by-mike-gunderloy/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Rails is a powerful development tool for web applications &#8211; but that power can lead inexperienced developers astray. If you&#039;re working on a Rails project gone bad, the targeted advice in this ebook will get you back on track quickly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ivanenviroman.com/rails-rescue-handbook-an-ebook-by-mike-gunderloy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Pragmatic Programmer</title>
		<link>http://www.ivanenviroman.com/the-pragmatic-programmer/</link>
		<comments>http://www.ivanenviroman.com/the-pragmatic-programmer/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 03:23:23 +0000</pubDate>
		<dc:creator>ivanoats</dc:creator>
				<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.ivanenviroman.com/?p=1620</guid>
		<description><![CDATA[The Pragmatic Programmer: From Journeyman to Master by Andrew Hunt My rating: 4 of 5 stars A little dated if you&#8217;re using a framework like Ruby on Rails, but definitely worth reviewing and further study. Lots of great practices. I &#8230; <a href="http://www.ivanenviroman.com/the-pragmatic-programmer/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.goodreads.com/book/show/4099.The_Pragmatic_Programmer_From_Journeyman_to_Master" style="float: left; padding-right: 20px"><img alt="The Pragmatic Programmer: From Journeyman to Master" border="0" src="http://photo.goodreads.com/books/1165384260m/4099.jpg" /></a> <a href="http://www.goodreads.com/book/show/4099.The_Pragmatic_Programmer_From_Journeyman_to_Master">The Pragmatic Programmer: From Journeyman to Master</a> by <a href="http://www.goodreads.com/author/show/2812.Andrew_Hunt">Andrew Hunt</a></p>
<p>My rating: <a href="http://www.goodreads.com/review/show/72957057">4 of 5 stars</a><br />
A little dated if you&#8217;re using a framework like Ruby on Rails, but definitely worth reviewing and further study. Lots of great practices. I feel like this book gives you the foundational understanding to what inspired many current Ruby on Rails practices.</p>
<p><a href="http://www.goodreads.com/review/list/1159140-ivan">View all my reviews >></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ivanenviroman.com/the-pragmatic-programmer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Render error when upgrading from rails 1 to rails 2</title>
		<link>http://www.ivanenviroman.com/render-error-when-upgrading-from-rails-1-to-rails-2/</link>
		<comments>http://www.ivanenviroman.com/render-error-when-upgrading-from-rails-1-to-rails-2/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 00:04:57 +0000</pubDate>
		<dc:creator>Ivan Storck</dc:creator>
				<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[footnotes]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ror]]></category>
		<category><![CDATA[textmate]]></category>

		<guid isPermaLink="false">http://www.ivanenviroman.com/?p=475</guid>
		<description><![CDATA[When upgrading an old ruby on rails 1.2 application to rails 2.2.2, I ran into a frustrating, somewhat un-google-able error, so I&#8217;m writing down the solution here. If you get a render with invalid options error, the solution is to &#8230; <a href="http://www.ivanenviroman.com/render-error-when-upgrading-from-rails-1-to-rails-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When upgrading an old ruby on rails 1.2 application to rails 2.2.2, I ran into a frustrating, somewhat un-google-able error, so I&#8217;m writing down the solution here.</p>
<p>If you get a render with invalid options error,  the solution is to uninstall the textmate footnotes plugin, and use the rails-footnotes plugin instead.</p>
<p>Thanks to<a href="http://blog.zohrob.com/?p=29"> David Zohrob&#8217;s blog post</a> for helping me figure this out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ivanenviroman.com/render-error-when-upgrading-from-rails-1-to-rails-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Screen Scraping with Ruby</title>
		<link>http://www.ivanenviroman.com/screen-scraping-with-ruby/</link>
		<comments>http://www.ivanenviroman.com/screen-scraping-with-ruby/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 20:19:15 +0000</pubDate>
		<dc:creator>ivanoats</dc:creator>
				<category><![CDATA[Bookmarks]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[screenscraping]]></category>

		<guid isPermaLink="false">http://delicious.com/url/ae4d7a5067bac8b38ee503ebc7727569#ivanoats</guid>
		<description><![CDATA[Useful short presentation explaining regular expressions, xpath, firebug, hpricot and screen scraping <a href="http://www.ivanenviroman.com/screen-scraping-with-ruby/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Useful short presentation explaining regular expressions, xpath, firebug, hpricot and screen scraping</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ivanenviroman.com/screen-scraping-with-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open Source Rails</title>
		<link>http://www.ivanenviroman.com/open-source-rails/</link>
		<comments>http://www.ivanenviroman.com/open-source-rails/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 05:34:31 +0000</pubDate>
		<dc:creator>ivanoats</dc:creator>
				<category><![CDATA[Bookmarks]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://delicious.com/url/4109d2b54d8dcf7fa5f0a700c745d2ee#ivanoats</guid>
		<description><![CDATA[Open Source Rails features an easy to browse gallery of the best open source / freely available rails projects.

Each project features screenshots plus community driven comments, ratings, and bookmarking.

If you have a Rails project that you&#39;re considering to release to the community, please let us know and we&#39;ll help you get featured, and hopefully build up a community to help build and extend your project. <a href="http://www.ivanenviroman.com/open-source-rails/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Open Source Rails features an easy to browse gallery of the best open source / freely available rails projects.</p>
<p>Each project features screenshots plus community driven comments, ratings, and bookmarking.</p>
<p>If you have a Rails project that you&#39;re considering to release to the community, please let us know and we&#39;ll help you get featured, and hopefully build up a community to help build and extend your project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ivanenviroman.com/open-source-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>zena</title>
		<link>http://www.ivanenviroman.com/zena/</link>
		<comments>http://www.ivanenviroman.com/zena/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 02:29:14 +0000</pubDate>
		<dc:creator>ivanoats</dc:creator>
				<category><![CDATA[Bookmarks]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://delicious.com/url/b71dc87a6d2e26c8a86cb9f2e23625ab#ivanoats</guid>
		<description><![CDATA[zena is a state-of-the-art CMS (content managment system) based on Ruby on Rails with a focus on usability, ease of customization and web 2.0 goodness (application like behaviour). <a href="http://www.ivanenviroman.com/zena/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>zena is a state-of-the-art CMS (content managment system) based on Ruby on Rails with a focus on usability, ease of customization and web 2.0 goodness (application like behaviour).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ivanenviroman.com/zena/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>404 error pages in Rails</title>
		<link>http://www.ivanenviroman.com/404-error-pages-in-rails/</link>
		<comments>http://www.ivanenviroman.com/404-error-pages-in-rails/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 05:21:58 +0000</pubDate>
		<dc:creator>Ivan Storck</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[404]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[rubyonrails]]></category>

		<guid isPermaLink="false">http://www.ivanenviroman.com/404-error-pages-in-rails/</guid>
		<description><![CDATA[I&#8217;m always trying to encourage visitors to my website to find the right information. I&#8217;m also pretty lazy with typing and want to be able to just guess at URL&#8217;s and see if they work. The new website system for &#8230; <a href="http://www.ivanenviroman.com/404-error-pages-in-rails/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m always trying to encourage visitors to my website to find the right information. I&#8217;m also pretty lazy with typing and want to be able to just guess at URL&#8217;s and see if they work.</p>
<p>The new website system for Sustainable Websites, built in Ruby on Rails, has articles (called posts in WordPress) and pages. I wanted the page not found (HTTP status 404) page to automatically direct them to the appropriate page, if it exists, or article, and if it doesn&#8217;t exist, provide some suggested links and a search box (pre-filled with some keywords from the URL they tried).</p>
<div>The initial part of this was based on Recipe 7 (page 43) of:<img src="http://ecx.images-amazon.com/images/I/513getfsjBL._SL160_.jpg" width="133" height="160" name="513getfsjBL._SL160_.jpg" style="margin-bottom: 5px; margin-right: 5px; float: left;" /><a href="http://www.amazon.com/Advanced-Rails-Recipes-Pragmatic-Programmers/dp/0978739221%3FSubscriptionId%3D0PZ7TM66EXQCXFVTMTR2%26tag%3Dfindmassage-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0978739221">&#8220;Advanced Rails Recipes: 84 New Ways to Build Stunning Rails Apps (Pragmatic Programmers)&#8221; (Mike Clark)</a></div>
<p><br style="float: clear" /></p>
<p style="float: clear">The first part was setting up a default route in routes.rb:</p>
<pre name="code" class="ruby"># 404 handler
map.connect '*path', :controller =&gt; 'four_oh_fours'
</pre>
<p>then here&#8217;s the 404 controller:</p>
<pre name="code" class="ruby">
class FourOhFoursController < ApplicationController
   def index
   #clean the slash out of request.path.
   cleaned_path = request.path.gsub(/\//," ").strip
   #if request.path is in the set of page permalinks then redirect to that page
   to_page = Page.find_by_permalink(cleaned_path)
   if to_page then
     redirect_to page_permalink_url(to_page.permalink) and return false
   end
   #same if it is an article name
   to_article = Article.find_by_permalink(cleaned_path)
   if to_article then
     redirect_to permalink_url(to_article.permalink) and return false
   end

   #TODO: same if it a username?

   FourOhFour.add_request(request.host, request.path, request.env['HTTP_REFERER'] || '')
   respond_to do |format|
     format.html { render :file =&gt; "#{RAILS_ROOT}/public/404.html", :status =&gt; "404 Not Found" }
     format.all { render :nothing =&gt; true, :status =&gt; "404 Not Found" }
   end
   end
end
</pre>
<p>It uses the Page model's find_by_permalink method but I could have easily just used find by title or another attribute of Pages.</p>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ivanenviroman.com/404-error-pages-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails SEO Tips</title>
		<link>http://www.ivanenviroman.com/ruby-on-rails-seo-tips/</link>
		<comments>http://www.ivanenviroman.com/ruby-on-rails-seo-tips/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 05:40:47 +0000</pubDate>
		<dc:creator>ivanoats</dc:creator>
				<category><![CDATA[Bookmarks]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[seo]]></category>

		<guid isPermaLink="false">http://delicious.com/url/5409968f0a810226715ac442781ff634#ivanoats</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[]]></content:encoded>
			<wfw:commentRss>http://www.ivanenviroman.com/ruby-on-rails-seo-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails Code Quality Checklist &#8211; Articles &#8211; Matthew Moore</title>
		<link>http://www.ivanenviroman.com/ruby-on-rails-code-quality-checklist-articles-matthew-moore/</link>
		<comments>http://www.ivanenviroman.com/ruby-on-rails-code-quality-checklist-articles-matthew-moore/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 05:35:32 +0000</pubDate>
		<dc:creator>ivanoats</dc:creator>
				<category><![CDATA[Bookmarks]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[bestpractice]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[quality]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://delicious.com/url/49c742abe61c3d4d5c5457624bc50111#ivanoats</guid>
		<description><![CDATA[In Matt Moore&#039;s experience, Ruby and Ruby on Rails has been one of the most difficult language/framework combinations to truly master.  For someone who grew up on C, C++ &#38; Java in the majority of their training, Ruby has hugely different (and better!) ways of OO design, and the Rails framework has a lot of opinions to be understood and remembered.  As long as it&#039;s taken to master them to the level he has - and he&#039;s sure there&#039;s still a long way to go - he loves it and won&#039;t be going back. <a href="http://www.ivanenviroman.com/ruby-on-rails-code-quality-checklist-articles-matthew-moore/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In Matt Moore&#039;s experience, Ruby and Ruby on Rails has been one of the most difficult language/framework combinations to truly master.  For someone who grew up on C, C++ &amp; Java in the majority of their training, Ruby has hugely different (and better!) ways of OO design, and the Rails framework has a lot of opinions to be understood and remembered.  As long as it&#039;s taken to master them to the level he has &#8211; and he&#039;s sure there&#039;s still a long way to go &#8211; he loves it and won&#039;t be going back.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ivanenviroman.com/ruby-on-rails-code-quality-checklist-articles-matthew-moore/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
