<?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: Removing Rails validations with metaprogramming</title>
	<atom:link href="http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/feed/" rel="self" type="application/rss+xml" />
	<link>http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/</link>
	<description>expert ruby on rails development</description>
	<lastBuildDate>Sun, 18 Apr 2010 10:22:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Casper Fabricius</title>
		<link>http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/comment-page-1/#comment-1362</link>
		<dc:creator>Casper Fabricius</dc:creator>
		<pubDate>Thu, 18 Feb 2010 08:04:28 +0000</pubDate>
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=153#comment-1362</guid>
		<description>Ben, that looks awesome. Any chance you can change it into a plugin so it can be used in any Rails project?</description>
		<content:encoded><![CDATA[<p>Ben, that looks awesome. Any chance you can change it into a plugin so it can be used in any Rails project?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Evans</title>
		<link>http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/comment-page-1/#comment-1361</link>
		<dc:creator>Ben Evans</dc:creator>
		<pubDate>Wed, 17 Feb 2010 20:55:35 +0000</pubDate>
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=153#comment-1361</guid>
		<description>After doing some more playing around with your method and the one I linked in my previous comment, I have created a Radiant extension that allows targeted removal of default validators without any &quot;hack&quot; style methods.

Using this extension, you can clear validations, or override targeted validations easily on Radiant core models. It does not take much more to also extend / override validations in extension models.

http://github.com/JediFreeman/Radiant-Validators-Extension</description>
		<content:encoded><![CDATA[<p>After doing some more playing around with your method and the one I linked in my previous comment, I have created a Radiant extension that allows targeted removal of default validators without any &#8220;hack&#8221; style methods.</p>
<p>Using this extension, you can clear validations, or override targeted validations easily on Radiant core models. It does not take much more to also extend / override validations in extension models.</p>
<p><a href="http://github.com/JediFreeman/Radiant-Validators-Extension" rel="nofollow">http://github.com/JediFreeman/Radiant-Validators-Extension</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Evans</title>
		<link>http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/comment-page-1/#comment-1355</link>
		<dc:creator>Ben Evans</dc:creator>
		<pubDate>Fri, 12 Feb 2010 01:57:34 +0000</pubDate>
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=153#comment-1355</guid>
		<description>I was playing with trying to modify the validation for the slug on radiant pages, it currently does not allow anything but numbers/letters... I could not get your script working with my code, but I was able to get this guy&#039;s solution working. The downside is that in my PageExtension class, I had to put all the validations from the Radiant Page class in the process.  http://www.neverlet.be/2009/2/18/active-record-validations-are-callbacks</description>
		<content:encoded><![CDATA[<p>I was playing with trying to modify the validation for the slug on radiant pages, it currently does not allow anything but numbers/letters&#8230; I could not get your script working with my code, but I was able to get this guy&#8217;s solution working. The downside is that in my PageExtension class, I had to put all the validations from the Radiant Page class in the process.  <a href="http://www.neverlet.be/2009/2/18/active-record-validations-are-callbacks" rel="nofollow">http://www.neverlet.be/2009/2/18/active-record-validations-are-callbacks</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Casper Fabricius</title>
		<link>http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/comment-page-1/#comment-312</link>
		<dc:creator>Casper Fabricius</dc:creator>
		<pubDate>Sun, 22 Feb 2009 15:40:17 +0000</pubDate>
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=153#comment-312</guid>
		<description>Nice solution, Will - I actually like that better than mine for this particular case. It is cleaner as you say, and easier to read and understand - less magic. Still, I mostly blogged about my solution because I found it an interesting study into how far you can go with Ruby :)</description>
		<content:encoded><![CDATA[<p>Nice solution, Will &#8211; I actually like that better than mine for this particular case. It is cleaner as you say, and easier to read and understand &#8211; less magic. Still, I mostly blogged about my solution because I found it an interesting study into how far you can go with Ruby :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will</title>
		<link>http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/comment-page-1/#comment-311</link>
		<dc:creator>Will</dc:creator>
		<pubDate>Sun, 22 Feb 2009 13:26:57 +0000</pubDate>
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=153#comment-311</guid>
		<description>Hello Casper. Very interesting that so many of us are working on this. Here&#039;s what I ended up with. It seems a cleaner way but without as much control as your later intervention.

To be included into ActiveRecord::Validations::ClassMethods:

&lt;code&gt;
module MultiSite::ScopedValidation

  def self.included(base)

    def validates_uniqueness_of_with_site(*attr)
      if column_names.include?(&#039;site_id&#039;)
        configuration = attr.extract_options!
        configuration[:scope] &#124;&#124;= :site_id
        attr.push(configuration)
      end
      validates_uniqueness_of_without_site(*attr)  
    end
    
    base.alias_method_chain :validates_uniqueness_of, :site

  end
end
&lt;/code&gt;

I really don&#039;t like the site_id assumption, but afaik validations are hit too early in the initialization sequence for anything more properly configurable to work. Would love to be wrong about that.

This is from a fork of multi_site that I&#039;m using to provide site-scoping to other extensions. I&#039;d be very glad of any comments. http://github.com/spanner/radiant-multi-site-extension</description>
		<content:encoded><![CDATA[<p>Hello Casper. Very interesting that so many of us are working on this. Here&#8217;s what I ended up with. It seems a cleaner way but without as much control as your later intervention.</p>
<p>To be included into ActiveRecord::Validations::ClassMethods:</p>
<p><code><br />
module MultiSite::ScopedValidation</p>
<p>  def self.included(base)</p>
<p>    def validates_uniqueness_of_with_site(*attr)<br />
      if column_names.include?('site_id')<br />
        configuration = attr.extract_options!<br />
        configuration[:scope] ||= :site_id<br />
        attr.push(configuration)<br />
      end<br />
      validates_uniqueness_of_without_site(*attr)<br />
    end</p>
<p>    base.alias_method_chain :validates_uniqueness_of, :site</p>
<p>  end<br />
end<br />
</code></p>
<p>I really don&#8217;t like the site_id assumption, but afaik validations are hit too early in the initialization sequence for anything more properly configurable to work. Would love to be wrong about that.</p>
<p>This is from a fork of multi_site that I&#8217;m using to provide site-scoping to other extensions. I&#8217;d be very glad of any comments. <a href="http://github.com/spanner/radiant-multi-site-extension" rel="nofollow">http://github.com/spanner/radiant-multi-site-extension</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AC</title>
		<link>http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/comment-page-1/#comment-267</link>
		<dc:creator>AC</dc:creator>
		<pubDate>Fri, 23 Jan 2009 20:19:19 +0000</pubDate>
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=153#comment-267</guid>
		<description>Looks good.  I might have to use this for some crap validation that some plugins/gems have for email which deny valid RFC822 emails.</description>
		<content:encoded><![CDATA[<p>Looks good.  I might have to use this for some crap validation that some plugins/gems have for email which deny valid RFC822 emails.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aditya</title>
		<link>http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/comment-page-1/#comment-249</link>
		<dc:creator>Aditya</dc:creator>
		<pubDate>Wed, 10 Dec 2008 03:52:45 +0000</pubDate>
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=153#comment-249</guid>
		<description>haha - nope, I was going to propose we coerce^Wconvince Sean to add it to Radiant ;-) 

Great work on the extensions though, Josh Hart clued me in...</description>
		<content:encoded><![CDATA[<p>haha &#8211; nope, I was going to propose we coerce^Wconvince Sean to add it to Radiant ;-) </p>
<p>Great work on the extensions though, Josh Hart clued me in&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Casper Fabricius</title>
		<link>http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/comment-page-1/#comment-247</link>
		<dc:creator>Casper Fabricius</dc:creator>
		<pubDate>Sun, 07 Dec 2008 10:01:01 +0000</pubDate>
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=153#comment-247</guid>
		<description>It is a hack, and an ugly one at that, but since I was writing an extension to be released, I could not rely on changing someone else&#039;s code.

All changes had to be done from my code, but if you have a trick up your sleeve for adding that :if =&gt; without modifying existing code I&#039;d like to see it :)</description>
		<content:encoded><![CDATA[<p>It is a hack, and an ugly one at that, but since I was writing an extension to be released, I could not rely on changing someone else&#8217;s code.</p>
<p>All changes had to be done from my code, but if you have a trick up your sleeve for adding that :if => without modifying existing code I&#8217;d like to see it :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aditya</title>
		<link>http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/comment-page-1/#comment-246</link>
		<dc:creator>Aditya</dc:creator>
		<pubDate>Sun, 07 Dec 2008 08:35:51 +0000</pubDate>
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=153#comment-246</guid>
		<description>Whoa.  I was running into the exact same thing with mutli_site - login seems to be unque in the User model and there&#039;s no good way of removing the validation.  The thing I&#039;m proposing is to add an :if =&gt; should_validate_unique_login but I&#039;m not so sure if that&#039;s the best option...

Overriding validations just seems like a hack.</description>
		<content:encoded><![CDATA[<p>Whoa.  I was running into the exact same thing with mutli_site &#8211; login seems to be unque in the User model and there&#8217;s no good way of removing the validation.  The thing I&#8217;m proposing is to add an :if =&gt; should_validate_unique_login but I&#8217;m not so sure if that&#8217;s the best option&#8230;</p>
<p>Overriding validations just seems like a hack.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
