Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Corey Innis's Profile

GitHub User: coreyti

Site: http://coolerator.net

Comments by Corey Innis

Avatar

Exactly right. This why, if I "must" use AR in a migration, I prefer to redefine (much simplified) classes within the migration file... ensuring that the AR class definitions match the db schema.

Also, for large datasets, executing SQL rather than instantiating AR records can mean your migration runs in seconds rather than minutes/hours.