Created
January 12, 2011 20:21
-
-
Save raykrueger/776806 to your computer and use it in GitHub Desktop.
Example of safely using ActiveRecord models within a migration.
This file contains hidden or 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
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 |
you go to hell!
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
I hate your Gist, bleh!