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/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to