Created
November 2, 2010 06:45
-
-
Save airy/659334 to your computer and use it in GitHub Desktop.
polymorphic migration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails g migration Something attachable:polymorphic | |
or | |
rails g scaffold Something attachable:polymorphic | |
may can generate migration like this: | |
def self.up | |
create_table :somethings do |t| | |
t.references attachable, polymorphic => true | |
and model | |
class Something < ActiveRecord::Base | |
belongs_to :attachable, :polymorphic => true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment