<?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"
	>
<channel>
	<title>Comments on: Learning Rails: Many-to-Many Relationships</title>
	<atom:link href="http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/feed/" rel="self" type="application/rss+xml" />
	<link>http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/</link>
	<description>nullae paenitentiae</description>
	<pubDate>Sat, 05 Jul 2008 01:27:54 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: dwhsix</title>
		<link>http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-49133</link>
		<dc:creator>dwhsix</dc:creator>
		<pubDate>Sun, 27 Apr 2008 15:26:21 +0000</pubDate>
		<guid isPermaLink="false">http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-49133</guid>
		<description>Great example for a non-trivial m:m relationship.  Wasn't /exactly/ what I needed, but pointed me in the right direction to resolve a problem that had me baffled for a day...</description>
		<content:encoded><![CDATA[<p>Great example for a non-trivial m:m relationship.  Wasn&#8217;t /exactly/ what I needed, but pointed me in the right direction to resolve a problem that had me baffled for a day&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: grateful</title>
		<link>http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-46245</link>
		<dc:creator>grateful</dc:creator>
		<pubDate>Wed, 12 Dec 2007 19:25:23 +0000</pubDate>
		<guid isPermaLink="false">http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-46245</guid>
		<description>Joel: I disagree with confused and reallyu appreciate the example. Yes, a couple of tables than the basics but it was based on a real world example of Flickr which made this tutorial different, and in my opinion, better. There are a handful of the way-too simplified versions out there for people who want the very basics. Your example had the added advantage of showing a real-world practical dimension that the others don't due to the simplicity. Thanks!</description>
		<content:encoded><![CDATA[<p>Joel: I disagree with confused and reallyu appreciate the example. Yes, a couple of tables than the basics but it was based on a real world example of Flickr which made this tutorial different, and in my opinion, better. There are a handful of the way-too simplified versions out there for people who want the very basics. Your example had the added advantage of showing a real-world practical dimension that the others don&#8217;t due to the simplicity. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joel</title>
		<link>http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-45280</link>
		<dc:creator>Joel</dc:creator>
		<pubDate>Thu, 29 Nov 2007 04:10:50 +0000</pubDate>
		<guid isPermaLink="false">http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-45280</guid>
		<description>&lt;strong&gt;@confused:&lt;/strong&gt; while I understand your comment regarding the complexity of the tutorial, it was because I couldn't find any tutorials that covered ordered-many-to-many relationships that I wrote this one. True, it does involve two relationships (collection-to-set and set-to-image) and thus has five tables, it was based on a real world (and highly useful) "gallery" system - &lt;a href="http://flickr.com" rel="nofollow"&gt;flickr&lt;/a&gt;. So, I apologise for the complexity but countenance that this was about my learning process and the tips and tricks associated with how to do things when I couldn't find relevant tutorials already in existence.</description>
		<content:encoded><![CDATA[<p><strong>@confused:</strong> while I understand your comment regarding the complexity of the tutorial, it was because I couldn&#8217;t find any tutorials that covered ordered-many-to-many relationships that I wrote this one. True, it does involve two relationships (collection-to-set and set-to-image) and thus has five tables, it was based on a real world (and highly useful) &#8220;gallery&#8221; system - <a href="http://flickr.com" rel="nofollow">flickr</a>. So, I apologise for the complexity but countenance that this was about my learning process and the tips and tricks associated with how to do things when I couldn&#8217;t find relevant tutorials already in existence.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: confused</title>
		<link>http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-45279</link>
		<dc:creator>confused</dc:creator>
		<pubDate>Thu, 29 Nov 2007 03:51:57 +0000</pubDate>
		<guid isPermaLink="false">http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-45279</guid>
		<description>For the title "Learning Rails: Many-to-Many Relationships", I don't think you could have come up with a more confusing example. If you intend for beginners to "Learn" about "Many-to-Many Relationships", a stripped down example (with 3 models maximum) would be more effective.

Thank you, none the less, for the code, once I decipher it.</description>
		<content:encoded><![CDATA[<p>For the title &#8220;Learning Rails: Many-to-Many Relationships&#8221;, I don&#8217;t think you could have come up with a more confusing example. If you intend for beginners to &#8220;Learn&#8221; about &#8220;Many-to-Many Relationships&#8221;, a stripped down example (with 3 models maximum) would be more effective.</p>
<p>Thank you, none the less, for the code, once I decipher it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joel</title>
		<link>http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-30447</link>
		<dc:creator>Joel</dc:creator>
		<pubDate>Fri, 06 Jul 2007 06:08:25 +0000</pubDate>
		<guid isPermaLink="false">http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-30447</guid>
		<description>You obviously failed to notice where it was filed (&lt;a href="http://euphemize.net/blog/archives/category/designprogramming/ruby-on-rails/" title="View all posts in Ruby on Rails" rel="category tag" rel="nofollow"&gt;Ruby on Rails&lt;/a&gt;,  &lt;a href="http://euphemize.net/blog/archives/category/designprogramming/" title="View all posts in design programming" rel="category tag" rel="nofollow"&gt;design programming&lt;/a&gt;) or it's tags (&lt;span class="UTWPrimaryTags"&gt;&lt;a href="http://www.technorati.com/tag/" rel="nofollow"&gt;&lt;img src="http://euphemize.net/blog/wp-content/plugins/UltimateTagWarrior/technoratiicon.jpg" alt="Technorati"/&gt;&lt;/a&gt; &lt;a href="http://www.technorati.com/tag/has many" rel="tag" rel="nofollow"&gt;has many&lt;/a&gt;, &lt;a href="http://www.technorati.com/tag/many to many relationship" rel="tag" rel="nofollow"&gt;many to many relationship&lt;/a&gt;, &lt;a href="http://www.technorati.com/tag/programming" rel="tag" rel="nofollow"&gt;programming&lt;/a&gt;, &lt;a href="http://www.technorati.com/tag/Rails" rel="tag" rel="nofollow"&gt;Rails&lt;/a&gt;, &lt;a href="http://www.technorati.com/tag/Ruby" rel="tag" rel="nofollow"&gt;Ruby&lt;/a&gt;, &lt;a href="http://www.technorati.com/tag/ruby on rails" rel="tag" rel="nofollow"&gt;ruby on rails&lt;/a&gt;, &lt;a href="http://www.technorati.com/tag/through" rel="tag" rel="nofollow"&gt;through&lt;/a&gt;, &lt;a href="http://www.technorati.com/tag/tutorial" rel="tag" rel="nofollow"&gt;tutorial&lt;/a&gt;&lt;/span&gt;) and those combined with the title referring to "Learning Rails" makes it pretty obvious that it was not about spilling my heart on life, love and women.</description>
		<content:encoded><![CDATA[<p>You obviously failed to notice where it was filed (<a href="http://euphemize.net/blog/archives/category/designprogramming/ruby-on-rails/" title="View all posts in Ruby on Rails" rel="category tag" rel="nofollow">Ruby on Rails</a>,  <a href="http://euphemize.net/blog/archives/category/designprogramming/" title="View all posts in design programming" rel="category tag" rel="nofollow">design programming</a>) or it&#8217;s tags (<span class="UTWPrimaryTags"><a href="http://www.technorati.com/tag/" rel="nofollow"><img src="http://euphemize.net/blog/wp-content/plugins/UltimateTagWarrior/technoratiicon.jpg" alt="Technorati"/></a> <a href="http://www.technorati.com/tag/has many" rel="tag" rel="nofollow">has many</a>, <a href="http://www.technorati.com/tag/many to many relationship" rel="tag" rel="nofollow">many to many relationship</a>, <a href="http://www.technorati.com/tag/programming" rel="tag" rel="nofollow">programming</a>, <a href="http://www.technorati.com/tag/Rails" rel="tag" rel="nofollow">Rails</a>, <a href="http://www.technorati.com/tag/Ruby" rel="tag" rel="nofollow">Ruby</a>, <a href="http://www.technorati.com/tag/ruby on rails" rel="tag" rel="nofollow">ruby on rails</a>, <a href="http://www.technorati.com/tag/through" rel="tag" rel="nofollow">through</a>, <a href="http://www.technorati.com/tag/tutorial" rel="tag" rel="nofollow">tutorial</a></span>) and those combined with the title referring to &#8220;Learning Rails&#8221; makes it pretty obvious that it was not about spilling my heart on life, love and women.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sarah</title>
		<link>http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-30446</link>
		<dc:creator>sarah</dc:creator>
		<pubDate>Fri, 06 Jul 2007 05:42:51 +0000</pubDate>
		<guid isPermaLink="false">http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-30446</guid>
		<description>ok i decided to read this post as i thought it would be some heart felt spill on life and woman. PLEASE NEVER do that to me again!!! you are banned from providing misleading titles in you posts!!!</description>
		<content:encoded><![CDATA[<p>ok i decided to read this post as i thought it would be some heart felt spill on life and woman. PLEASE NEVER do that to me again!!! you are banned from providing misleading titles in you posts!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joel</title>
		<link>http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-28629</link>
		<dc:creator>Joel</dc:creator>
		<pubDate>Tue, 19 Jun 2007 20:48:47 +0000</pubDate>
		<guid isPermaLink="false">http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-28629</guid>
		<description>&lt;strong&gt;@Andrew:&lt;/strong&gt; I will be writing up anything I find useful that I can't find assistance with on the web.

In terms of a migration for the tables, it would look something like this (I'll update in the post too):

&lt;pre&gt;class CreateImages &lt; ActiveRecord::Migration
  def self.up
    create_table :images do &#124;t&#124;
      t.column :name, :string, :null =&gt; false
      t.column :permalink, :string, :null =&gt; false
      t.column :description, :text, :null =&gt; false
      t.column :filename, :text, :null =&gt; false
    end
  end

  def self.down
    drop_table :images
  end
end&lt;/pre&gt;

&lt;pre&gt;class CreateSets &lt; ActiveRecord::Migration
  def self.up
    create_table :sets do &#124;t&#124;
      t.column :name, :string, :null =&gt; false
      t.column :permalink, :string, :null =&gt; false
      t.column :description, :text, :default =&gt; nil
    end
  end

  def self.down
    drop_table :sets
  end
end&lt;/pre&gt;

and the complex join table

&lt;pre&gt;class CreateImagesets &lt; ActiveRecord::Migration
  def self.up
    create_table :imagesets do &#124;t&#124;
      t.column :position, :int, :null =&gt; false
      t.column :gallery_id, :int, :null =&gt; false
      t.column :image_id, :int, :null =&gt; false
    end
    
    execute "alter table imagesets add foreign key (set_id) references sets(id)"
    execute "alter table imagesets add foreign key (image_id) references images(id)"
    
  end

  def self.down
    drop_table :imagesets
  end
end&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p><strong>@Andrew:</strong> I will be writing up anything I find useful that I can&#8217;t find assistance with on the web.</p>
<p>In terms of a migration for the tables, it would look something like this (I&#8217;ll update in the post too):</p>
<pre>class CreateImages < ActiveRecord::Migration
  def self.up
    create_table :images do |t|
      t.column :name, :string, :null => false
      t.column :permalink, :string, :null => false
      t.column :description, :text, :null => false
      t.column :filename, :text, :null => false
    end
  end

  def self.down
    drop_table :images
  end
end</pre>
<pre>class CreateSets < ActiveRecord::Migration
  def self.up
    create_table :sets do |t|
      t.column :name, :string, :null => false
      t.column :permalink, :string, :null => false
      t.column :description, :text, :default => nil
    end
  end

  def self.down
    drop_table :sets
  end
end</pre>
<p>and the complex join table</p>
<pre>class CreateImagesets < ActiveRecord::Migration
  def self.up
    create_table :imagesets do |t|
      t.column :position, :int, :null => false
      t.column :gallery_id, :int, :null => false
      t.column :image_id, :int, :null => false
    end

    execute &#8220;alter table imagesets add foreign key (set_id) references sets(id)&#8221;
    execute &#8220;alter table imagesets add foreign key (image_id) references images(id)&#8221;

  end

  def self.down
    drop_table :imagesets
  end
end</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-28608</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Tue, 19 Jun 2007 15:23:34 +0000</pubDate>
		<guid isPermaLink="false">http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-28608</guid>
		<description>Great tutorial... there should be more stuff like this out there.

One question: How would you set up the tables for this?

Thanks.</description>
		<content:encoded><![CDATA[<p>Great tutorial&#8230; there should be more stuff like this out there.</p>
<p>One question: How would you set up the tables for this?</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fradam</title>
		<link>http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-25276</link>
		<dc:creator>Fradam</dc:creator>
		<pubDate>Mon, 04 Jun 2007 10:11:57 +0000</pubDate>
		<guid isPermaLink="false">http://euphemize.net/blog/archives/2007/06/04/learning-rails-many-to-many-relationships/#comment-25276</guid>
		<description>...due to a background in PHP, with itâ€™s rather lax type strictness....

Typo? I suspect you meant 'almost non-existent' ;)</description>
		<content:encoded><![CDATA[<p>&#8230;due to a background in PHP, with itâ€™s rather lax type strictness&#8230;.</p>
<p>Typo? I suspect you meant &#8216;almost non-existent&#8217; <img src='http://euphemize.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
</channel>
</rss>
