<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/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>Robby on Rails: Sneaking Rails through the (Legacy) system</title>
    <link>http://www.robbyonrails.com/articles/2006/04/14/sneaking-rails-through-the-legacy-system</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>thoughts.sort_by{|t| t[:topic]}.collect </description>
    <item>
      <title>Sneaking Rails through the (Legacy) system</title>
      <description>&lt;p&gt;I&amp;#8217;ll be posting stuff in the next few days about &lt;code&gt;acts_as_legacy&lt;/code&gt;. For those not at &lt;a href="http://www.canadaonrails.org"&gt;Canada on Rails&lt;/a&gt;... I announced a small project that I&amp;#8217;m going to be working on.&lt;/p&gt;


	&lt;h2&gt;Acts as Legacy!&lt;/h2&gt;


	&lt;p&gt;Here are my slides&amp;#8230; up til I tried to do a live demo. ;-)&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
# Inventory model
class Inventory &amp;lt; ActiveRecord::Base
  acts_as_legacy :table_name =&amp;gt; 'inventory',
                 :primary_key =&amp;gt; 'prod_id',

  has_one :product, :foreign_key =&amp;gt; self.primary_key

  column_alias :quan_in_stock, :stock

end   
&lt;/code&gt;&lt;/pre&gt;

Let&amp;#8217;s try something a little different&amp;#8230;
&lt;pre&gt;&lt;code&gt;
# SalesPerson model
class SalesPerson &amp;lt; ActiveRecord::Base
  acts_as_legacy :table_name =&amp;gt; 'sales_person',
                 :primary_key 'sales_p_id',
                 :column_alias =&amp;gt; 'sales_p_'

  validates_presence_of( :name, :email, :phone ) 
end

# usage....
SalesPerson.find( 7 ).sales_p_name
=&amp;gt; 'Nigel'
SalesPerson.find( 7 ).name
=&amp;gt; 'Nigel'
&lt;/code&gt;&lt;/pre&gt;

	&lt;h3&gt;The Slideshow&lt;/h3&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://www.planetargon.com/files/~robby/robby_russell_-_sneaking_rails_through_the_legacy_system.mov"&gt;Sneaking Rails through the (Legacy) System&lt;/a&gt; (quicktime)&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://www.planetargon.com/files/~robby/robby_russell_-_sneaking_rails_through_the_legacy_system.html"&gt;Sneaking Rails through the (Legacy) System&lt;/a&gt;  (flash)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;...Jeremy &lt;a href="http://www.jvoorhis.com/articles/2006/04/14/globalizing-rails-in-yvr"&gt;posted his slides&lt;/a&gt; as well. :-)&lt;/p&gt;
</description>
      <pubDate>Fri, 14 Apr 2006 18:01:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:8c83699a-16f7-4875-9b6c-5e43512a192b</guid>
      <author>Robby Russell</author>
      <link>http://www.robbyonrails.com/articles/2006/04/14/sneaking-rails-through-the-legacy-system</link>
      <category>Ruby on Rails</category>
      <category>Ruby</category>
      <category>Programming</category>
      <category>PostgreSQL</category>
      <category>canadaonrails</category>
      <category>rails</category>
    </item>
    <item>
      <title>"Sneaking Rails through the (Legacy) system" by Fabio Akita</title>
      <description>&lt;p&gt;I have nothing against the Surrogate Key-only for Active Record but do you intend to support intelligent keys (as the username in a User model) or even composite primary keys? Many people seems to miss those.&lt;/p&gt;</description>
      <pubDate>Thu, 29 Jun 2006 16:06:36 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:23a62259-0da6-4ae6-a749-dabba8b7b14b</guid>
      <link>http://www.robbyonrails.com/articles/2006/04/14/sneaking-rails-through-the-legacy-system#comment-10831</link>
    </item>
    <item>
      <title>"Sneaking Rails through the (Legacy) system" by Rob Goodwin</title>
      <description>&lt;p&gt;has commenting been fixed yet?&lt;/p&gt;</description>
      <pubDate>Sun, 30 Apr 2006 13:37:12 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:9cf61ae1-f21c-459e-9fd9-103b5a222929</guid>
      <link>http://www.robbyonrails.com/articles/2006/04/14/sneaking-rails-through-the-legacy-system#comment-2054</link>
    </item>
    <item>
      <title>"Sneaking Rails through the (Legacy) system" by Rob Sanheim</title>
      <description>&lt;p&gt;Hey Robby,&lt;/p&gt;


	&lt;p&gt;Is the code for this available anywhere?&lt;/p&gt;</description>
      <pubDate>Thu, 20 Apr 2006 11:56:08 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:c66f254d-90ba-4aaf-9bbb-197fae2953da</guid>
      <link>http://www.robbyonrails.com/articles/2006/04/14/sneaking-rails-through-the-legacy-system#comment-2021</link>
    </item>
  </channel>
</rss>
