<?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>A programmer&#039;s rants &#187; portugal</title>
	<atom:link href="http://blog.andremedeiros.info/tag/portugal/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.andremedeiros.info</link>
	<description>Random rants about code and life.</description>
	<lastBuildDate>Fri, 25 Sep 2009 10:40:45 +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>Rails, migrations and validations</title>
		<link>http://blog.andremedeiros.info/2008/05/rails-migrations-and-validations/</link>
		<comments>http://blog.andremedeiros.info/2008/05/rails-migrations-and-validations/#comments</comments>
		<pubDate>Fri, 09 May 2008 18:05:19 +0000</pubDate>
		<dc:creator>changelog</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[activerecord]]></category>
		<category><![CDATA[portugal]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[validations]]></category>

		<guid isPermaLink="false">http://blog.andremedeiros.info/?p=3</guid>
		<description><![CDATA[Well, it was a busy day for me in Ruby on Rails land. After picking up on a few new requirements for a project I&#8217;m working on (Agile Development rocks eh?), I&#8217;ve decided to refactor a lot of the existing codebase to make it a bit cleaner and, while I was at it, migrate the [...]]]></description>
			<content:encoded><![CDATA[<p>Well, it was a busy day for me in Ruby on Rails land. After picking up on a few new requirements for a project I&#8217;m working on (Agile Development rocks eh?), I&#8217;ve decided to refactor a lot of the existing codebase to make it a bit cleaner and, while I was at it, migrate the project to Rails 2. It wasn&#8217;t hard or very time consuming, thanks to <a href="http://www.slashdotdash.net/articles/2007/12/03/rails-2-upgrade-notes" target="_blank">Ben&#8217;s tips</a>, since it took me about 20 minutes to go through the offending lines.</p>
<p>One of the things I was able to extract from that refactoring was validations. Some models have to validate data that can&#8217;t be validated by a simple regular expression, and since these validations are specific in Portugal, I thought I&#8217;d share them with the portuguese Ruby on Rails developers. You can grab them following the link in the end of the post. After dropping the file on your project&#8217;s <code>lib</code> folder, all you have to do is add the following line to your <code>environment.rb</code> file:</p>
<div class="geshi no ruby">
<div class="head">RAILS_ROOT/config/environment.rb</div>
<ol>
<li class="li1">
<div class="de1"><span class="kw3">require</span> <span class="st0">&#39;validations&#39;</span></div>
</li>
</ol>
</div>
<p>And you&#8217;ll be ready to go. Documentation is included in the file (in Portuguese). Feedback is appreciated.</p>
<p><a title="Portugal-specific ActiveRecord validations' download link" href="http://blog.andremedeiros.info/upload/code/validations.rb">Download ActiveRecord validators for Portugal</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andremedeiros.info/2008/05/rails-migrations-and-validations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

