Skip to content

Instantly share code, notes, and snippets.

@geoffgarside
Created August 7, 2008 11:58
Show Gist options
  • Save geoffgarside/4382 to your computer and use it in GitHub Desktop.
Save geoffgarside/4382 to your computer and use it in GitHub Desktop.
class Accuracy < ActiveRecord::Base
belongs_to :measurable, :polymorphic => true
end
class Organisation < ActiveRecord::Base
has_one :accuracy, :as => :measurable
end
class CreateAccuracies < ActiveRecord::Migration
def self.up
create_table :accuracies do |t|
t.references :measurable, :polymorphic => true
t.integer :rating
t.timestamps
end
end
def self.down
drop_table :accuracies
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment