Hi, I was wondering if there is a way to skip the application of a named_scope to calls made in legacy migrations. I am working with some old migrations that include some data manipulation tasks, and my default scope is preventing those migrations from running. I''m trying to avoid editing those migration files with with_exclusive_scope. Thanks, -G -- Posted via http://www.ruby-forum.com/.
Greg Christopher wrote:> Hi, > > I was wondering if there is a way to skip the application of a > named_scope to calls made in legacy migrations. I am working with some > old migrations that include some data manipulation tasks, and my default > scope is preventing those migrations from running. I''m trying to avoid > editing those migration files with with_exclusive_scope.Generally speaking, you shouldn''t be running very old migrations -- for existing installations, the migrations get run one at a time, and for new installations, you should just use rake db:schema:load . You''ve found out a reason for this the hard way. :) What exactly are you trying to do?> > Thanks, > > -GBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
On Oct 17, 8:24 pm, Greg Christopher <rails-mailing-l...@andreas- s.net> wrote:> Hi, > > I was wondering if there is a way to skip the application of a > named_scope to calls made in legacy migrations. I am working with some > old migrations that include some data manipulation tasks, and my default > scope is preventing those migrations from running. I''m trying to avoid > editing those migration files with with_exclusive_scope. >Using your application''s models in migrations can get you in trouble, and often in a way that you only notice when deploying in production (since in development you probably run them one at a time but in production you''ll run all those that were part of the release you are deploying. If all you need is basic activerecord CRUD type functionality you can do class SomeMigration < ... class MyModel < ActiveRecord::Base; end def self.up MyModel.create(...) end end i.e. you basically have a class that is only used by the migration and won''t depend on any of the changes you may make to the application''s MyModel class. Fred> Thanks, > > -G > -- > Posted viahttp://www.ruby-forum.com/.