Skip to content

Instantly share code, notes, and snippets.

@raykrueger
Created January 12, 2011 20:21
Show Gist options
  • Save raykrueger/776806 to your computer and use it in GitHub Desktop.
Save raykrueger/776806 to your computer and use it in GitHub Desktop.
Example of safely using ActiveRecord models within a migration.
class DoSomeVoodooWithSomeModel < ActiveRecord::Migration
#this model will be used, not the one in app/models
#The User class is really a DoSomeVoodooWithSomeModel::User, that's the magic really
class User < ActiveRecord::Base; end
def self.up
#whatever
User.find(:first_name => "Ray")
end
def self.down
end
end
@tobrien
Copy link

tobrien commented Jan 13, 2011

I hate your Gist, bleh!

@raykrueger
Copy link
Author

you go to hell!

@tobrien
Copy link

tobrien commented Jan 13, 2011

No. I won't go to Hell, I don't even believe in Hell. I just want to start a Gist fight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment