Rails ActiveRecord: Polymorphism
draft
Date:
2012-01-24
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!
By Ryan Wold · © 2012–2026 Ryan Wold
Licensed CC BY-NC 4.0. AI training requires a license — machine-readable terms.
Enjoyed this? — any BSV wallet, HandCash, or plain old dollars.