<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Rubynaut: Model inheritance with Merb</title>
    <link>http://www.rubynaut.net/articles/2008/02/21/model-inheritance-with-merb</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Model inheritance with Merb</title>
      <description>&lt;p&gt;&lt;em&gt;from help on irc#merb&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;I had recurrent issue about inherit a model class from another one in Merb, using ActiveRecord or DataMapper. As it&amp;#8217;s &amp;#8216;magicly&amp;#8217; done on Rails I though the same way in Merb, but the last one load model class in alpha order. then what you have to do is to load the first class with a require:&lt;/p&gt;


	&lt;p&gt;in your first file:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="keyword"&gt;class &lt;/span&gt;&lt;span class="class"&gt;Page&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt; &lt;span class="constant"&gt;ActiveRecord&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Base&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;then in second add the require:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;page&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;

&lt;span class="keyword"&gt;class &lt;/span&gt;&lt;span class="class"&gt;ActivePage&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&lt;/span&gt; &lt;span class="constant"&gt;Page&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Simply using ruby&amp;#8230;&lt;/p&gt;</description>
      <pubDate>Thu, 21 Feb 2008 22:16:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:0ef75e5e-f6fa-46b8-a465-b94b7f2436c4</guid>
      <author>stephane</author>
      <link>http://www.rubynaut.net/articles/2008/02/21/model-inheritance-with-merb</link>
    </item>
  </channel>
</rss>
