Skip to content

Instantly share code, notes, and snippets.

@thoughtbot
Created August 4, 2009 21:22
Show Gist options
  • Save thoughtbot/161557 to your computer and use it in GitHub Desktop.
Save thoughtbot/161557 to your computer and use it in GitHub Desktop.
class Person < ActiveRecord::Base
has_one :address, :as => :addressable
end
class Company < ActiveRecord::Base
has_one :address, :as => :addressable
end
class Address < ActiveRecord::Base
belongs_to :addressable, :polymorphic => true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment