ryanwold.net

A civic-minded citizen seeking the singularity

An entry

Rails ActiveRecord: Polymorphism

Date: 2012-01-24
Status: draft
Tags: notes rails

Active Record's Polymorphism is proving quite useful recently:

class Agenda < Metadata
end

class Metadata < ActiveRecord::Base
  set_table_name 'metadata'
end

Agenda.find(:all) now gives only the Metadata table records with a 'type' column = Agenda.  Very clean!