<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Rails Forum - Ruby on Rails Help and Discussion Forum - Inheritence between Active Record models]]></title>
		<link>http://railsforum.com/viewtopic.php?id=51087</link>
		<description><![CDATA[The most recent posts in Inheritence between Active Record models.]]></description>
		<lastBuildDate>Wed, 31 Oct 2012 20:08:40 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Inheritence between Active Record models]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=156711#p156711</link>
			<description><![CDATA[<p>So I was able to access Animal from Dog by adding animal_id to Dog, but I cannot access any of the Dog methods, like license. When I do dog#methods, :license does not show up, only the Animal methods. I&#039;m not sure how to proceed.</p>]]></description>
			<author><![CDATA[dummy@example.com (jcblitz)]]></author>
			<pubDate>Wed, 31 Oct 2012 20:08:40 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=156711#p156711</guid>
		</item>
		<item>
			<title><![CDATA[Inheritence between Active Record models]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=156708#p156708</link>
			<description><![CDATA[<p>Using the classic Dog &lt; Animal, if both of these objects are persisted in the database, how do you wire them up together? For example, </p><div class="codebox"><pre><code>class Animal &lt; ActiveRecord::Base
  attr_accessible :sound
end

class Dog &lt; Animal
  attr_accessible :license
end</code></pre></div><p>So if I want to get an instance of Dog, I would do &quot;dog = Dog.find(1)&quot;, which should contain dog#license=123 and dog#sound=&quot;woof&quot;. The question I&#039;m having is how does rails / ActiveRecord wire together the correct instances of animal and dog? Does there need to be a belongs_to in dog? Which means I would need an animal_id in dog, which feels more like a &quot;has a&quot; instead of an &quot;is a&quot; relationship.</p>]]></description>
			<author><![CDATA[dummy@example.com (jcblitz)]]></author>
			<pubDate>Wed, 31 Oct 2012 17:57:36 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=156708#p156708</guid>
		</item>
	</channel>
</rss>
