<?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: Testing with foreign key constraints</title>
	<atom:link href="http://www.schuerig.de/michael/blog/index.php/2007/11/08/testing-with-foreign-key-constraints/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.schuerig.de/michael/blog/index.php/2007/11/08/testing-with-foreign-key-constraints/</link>
	<description>Sentenced to making sense</description>
	<lastBuildDate>Thu, 08 Apr 2010 22:54:36 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Cedar</title>
		<link>http://www.schuerig.de/michael/blog/index.php/2007/11/08/testing-with-foreign-key-constraints/comment-page-1/#comment-13775</link>
		<dc:creator>Cedar</dc:creator>
		<pubDate>Wed, 28 Nov 2007 04:17:41 +0000</pubDate>
		<guid isPermaLink="false">http://schuerig.de/michael/blog/index.php/2007/11/08/testing-with-foreign-key-constraints/#comment-13775</guid>
		<description>Thanks!

For anyone looking to use this approach with MySQL/InnoDB...

You can use these around the fixture.insert_fixtures block in Fixtures.rb:

connection.execute(&quot;SET FOREIGN_KEY_CHECKS = 0&quot;)
connection.execute(&quot;SET FOREIGN_KEY_CHECKS = 1&quot;)

And... I couldn&#039;t get the class_eval approach to work in /lib/.  I required &#039;active_record/fixtures&#039; and redefined Fixtures#self.create_fixtures directly in /config/environment.rb and this worked.

Cheers.</description>
		<content:encoded><![CDATA[<p>Thanks!</p>
<p>For anyone looking to use this approach with MySQL/InnoDB&#8230;</p>
<p>You can use these around the fixture.insert_fixtures block in Fixtures.rb:</p>
<p>connection.execute(&#8220;SET FOREIGN_KEY_CHECKS = 0&#8243;)<br />
connection.execute(&#8220;SET FOREIGN_KEY_CHECKS = 1&#8243;)</p>
<p>And&#8230; I couldn&#8217;t get the class_eval approach to work in /lib/.  I required &#8216;active_record/fixtures&#8217; and redefined Fixtures#self.create_fixtures directly in /config/environment.rb and this worked.</p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

