<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Sexy Validation in Edge Rails (Rails 3)</title>
	<atom:link href="http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3/</link>
	<description>The Lightweight Ramblings of Jamie Hill</description>
	<lastBuildDate>Thu, 12 Apr 2012 16:23:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Delicious Bookmarks for August 21st through August 22nd &#171; Lâmôlabs</title>
		<link>http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3/comment-page-1/#comment-4204</link>
		<dc:creator>Delicious Bookmarks for August 21st through August 22nd &#171; Lâmôlabs</dc:creator>
		<pubDate>Mon, 22 Aug 2011 20:04:58 +0000</pubDate>
		<guid isPermaLink="false">http://thelucid.com/?p=533#comment-4204</guid>
		<description>[...] Sexy Validation in Edge Rails (Rails 3) « The Lucid – August 21st  ( tags: rails3 rails validation ruby activerecord validations programming rubyonrails examples ) [...]</description>
		<content:encoded><![CDATA[<p>[...] Sexy Validation in Edge Rails (Rails 3) « The Lucid – August 21st  ( tags: rails3 rails validation ruby activerecord validations programming rubyonrails examples ) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamie</title>
		<link>http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3/comment-page-1/#comment-4202</link>
		<dc:creator>Jamie</dc:creator>
		<pubDate>Thu, 18 Aug 2011 13:54:55 +0000</pubDate>
		<guid isPermaLink="false">http://thelucid.com/?p=533#comment-4202</guid>
		<description>@Bob I would be inclined to just write a custom validate method for validations this complex.</description>
		<content:encoded><![CDATA[<p>@Bob I would be inclined to just write a custom validate method for validations this complex.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob</title>
		<link>http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3/comment-page-1/#comment-4200</link>
		<dc:creator>Bob</dc:creator>
		<pubDate>Mon, 15 Aug 2011 22:11:09 +0000</pubDate>
		<guid isPermaLink="false">http://thelucid.com/?p=533#comment-4200</guid>
		<description>Any way to do a validation in stages, for example

1&gt; check that last_name, first_name, and address aren&#039;t blank
2&gt; combine them into a variable in the model called validate
3&gt; make sure that validate is unique

Hopefully this would make sure that a person doesn&#039;t have two records, and allow a common name to have 2 different addresses.

I used before_validation and after_validation in 2.x, but not sure here

Thanks
Bob</description>
		<content:encoded><![CDATA[<p>Any way to do a validation in stages, for example</p>
<p>1&gt; check that last_name, first_name, and address aren&#8217;t blank<br />
2&gt; combine them into a variable in the model called validate<br />
3&gt; make sure that validate is unique</p>
<p>Hopefully this would make sure that a person doesn&#8217;t have two records, and allow a common name to have 2 different addresses.</p>
<p>I used before_validation and after_validation in 2.x, but not sure here</p>
<p>Thanks<br />
Bob</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamie</title>
		<link>http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3/comment-page-1/#comment-4160</link>
		<dc:creator>Jamie</dc:creator>
		<pubDate>Thu, 14 Jul 2011 14:49:28 +0000</pubDate>
		<guid isPermaLink="false">http://thelucid.com/?p=533#comment-4160</guid>
		<description>@Jay I can see that may be hard to track down if you accidentally leave the &quot;s&quot; off. I don&#039;t really see it as a design flaw though, how about setting up some syntax highlighting to warn when the singular is used (bright red or something)?</description>
		<content:encoded><![CDATA[<p>@Jay I can see that may be hard to track down if you accidentally leave the &#8220;s&#8221; off. I don&#8217;t really see it as a design flaw though, how about setting up some syntax highlighting to warn when the singular is used (bright red or something)?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: =&#62;Rockets and Bangs! at the Ji-V Hackathon &#124; mattkopecki</title>
		<link>http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3/comment-page-1/#comment-4157</link>
		<dc:creator>=&#62;Rockets and Bangs! at the Ji-V Hackathon &#124; mattkopecki</dc:creator>
		<pubDate>Wed, 29 Jun 2011 05:23:15 +0000</pubDate>
		<guid isPermaLink="false">http://thelucid.com/?p=533#comment-4157</guid>
		<description>[...] to all these new concepts that I had never worked with before. By the end of the day, I was writing form validation logic in Ruby, working with ActiveRecord Migrations and database tables, rake-ing my db, and testing our [...]</description>
		<content:encoded><![CDATA[<p>[...] to all these new concepts that I had never worked with before. By the end of the day, I was writing form validation logic in Ruby, working with ActiveRecord Migrations and database tables, rake-ing my db, and testing our [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay Levitt</title>
		<link>http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3/comment-page-1/#comment-4154</link>
		<dc:creator>Jay Levitt</dc:creator>
		<pubDate>Mon, 20 Jun 2011 18:56:15 +0000</pubDate>
		<guid isPermaLink="false">http://thelucid.com/?p=533#comment-4154</guid>
		<description>So we just discovered sort-of-a-design-flaw-not-exactly with sexy validations.  The Rails 3 way to do a unique validation is:

validates :first_name, :uniqueness =&gt; true

But this induces a common error:

validate :first_name, :uniqueness =&gt; true

And that mistake is *perfectly legal code that runs without error*.  It means &quot;Treat the method `first_name` as my validator function&quot;. The :uniqueness =&gt; true gets ignored, because it&#039;s an options hash that doesn&#039;t contain any options we care about.  first_name will always be an existing method; it&#039;s the first_name field on your model! And that doesn&#039;t add anything to `errors`, so the validation always succeeds.

Unfortunately, I can&#039;t think of a way around it without deprecating and renaming either validate (perhaps &quot;validator&quot;?) or validates.  Jamie, what do you think? Our own team has decided that we will never use the &quot;validate :method_name&quot; syntax; instead, we&#039;ll always use &quot;def validate&quot;, and our CI system will enforce the rule.</description>
		<content:encoded><![CDATA[<p>So we just discovered sort-of-a-design-flaw-not-exactly with sexy validations.  The Rails 3 way to do a unique validation is:</p>
<p>validates :first_name, :uniqueness =&gt; true</p>
<p>But this induces a common error:</p>
<p>validate :first_name, :uniqueness =&gt; true</p>
<p>And that mistake is *perfectly legal code that runs without error*.  It means &#8220;Treat the method `first_name` as my validator function&#8221;. The :uniqueness =&gt; true gets ignored, because it&#8217;s an options hash that doesn&#8217;t contain any options we care about.  first_name will always be an existing method; it&#8217;s the first_name field on your model! And that doesn&#8217;t add anything to `errors`, so the validation always succeeds.</p>
<p>Unfortunately, I can&#8217;t think of a way around it without deprecating and renaming either validate (perhaps &#8220;validator&#8221;?) or validates.  Jamie, what do you think? Our own team has decided that we will never use the &#8220;validate :method_name&#8221; syntax; instead, we&#8217;ll always use &#8220;def validate&#8221;, and our CI system will enforce the rule.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: leonardofaria.net &#8594; Validações personalizadas no Rails 3</title>
		<link>http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3/comment-page-1/#comment-4152</link>
		<dc:creator>leonardofaria.net &#8594; Validações personalizadas no Rails 3</dc:creator>
		<pubDate>Sun, 05 Jun 2011 23:08:20 +0000</pubDate>
		<guid isPermaLink="false">http://thelucid.com/?p=533#comment-4152</guid>
		<description>[...] foi um exemplo de como resolvi meu problema. Existem outros posts sobre o assunto por aí, boa sorte! Posts relacionados:sitemap.xml no [...]</description>
		<content:encoded><![CDATA[<p>[...] foi um exemplo de como resolvi meu problema. Existem outros posts sobre o assunto por aí, boa sorte! Posts relacionados:sitemap.xml no [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamie</title>
		<link>http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3/comment-page-1/#comment-4139</link>
		<dc:creator>Jamie</dc:creator>
		<pubDate>Thu, 05 May 2011 22:44:02 +0000</pubDate>
		<guid isPermaLink="false">http://thelucid.com/?p=533#comment-4139</guid>
		<description>@Eric The lib folder is fine, just add a &quot;require &#039;my_validator&#039;&quot; to the top of the model files that use them.</description>
		<content:encoded><![CDATA[<p>@Eric The lib folder is fine, just add a &#8220;require &#8216;my_validator&#8217;&#8221; to the top of the model files that use them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3/comment-page-1/#comment-4136</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Wed, 04 May 2011 21:39:41 +0000</pubDate>
		<guid isPermaLink="false">http://thelucid.com/?p=533#comment-4136</guid>
		<description>Thanks for this post, Jamie!

Where do you put your validators?  I&#039;ve found some other pages saying that lib is the place for custom validators but (as I now see in a comment above), that&#039;s not autoloaded.

I can get away with putting my validator in config/initializers, but I&#039;d like to know if there&#039;s a convention for files like these.  Removing autoloading of the lib folder implies (to me) that this isn&#039;t where the Rails community would expect such files</description>
		<content:encoded><![CDATA[<p>Thanks for this post, Jamie!</p>
<p>Where do you put your validators?  I&#8217;ve found some other pages saying that lib is the place for custom validators but (as I now see in a comment above), that&#8217;s not autoloaded.</p>
<p>I can get away with putting my validator in config/initializers, but I&#8217;d like to know if there&#8217;s a convention for files like these.  Removing autoloading of the lib folder implies (to me) that this isn&#8217;t where the Rails community would expect such files</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Validating URL/URI in Ruby on Rails 3 &#171; Distance To Here</title>
		<link>http://thelucid.com/2010/01/08/sexy-validation-in-edge-rails-rails-3/comment-page-1/#comment-4132</link>
		<dc:creator>Validating URL/URI in Ruby on Rails 3 &#171; Distance To Here</dc:creator>
		<pubDate>Fri, 29 Apr 2011 19:47:18 +0000</pubDate>
		<guid isPermaLink="false">http://thelucid.com/?p=533#comment-4132</guid>
		<description>[...] was a bit outdated, so I put together an updated validator that takes advantage of the new &quot;sexy validations&quot; provided in Rails 3. And here it [...]</description>
		<content:encoded><![CDATA[<p>[...] was a bit outdated, so I put together an updated validator that takes advantage of the new &#8220;sexy validations&#8221; provided in Rails 3. And here it [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

