Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Migration now points to db/migrate//

#4240

After this commit ( http://github.com/rails/rails/commit/541194f641c960efe739b16f76999f... ) when one runs rake db:migrate rails looks at db/migrate// instead of db/migrate/.

I am running Rail3 strait off of the git repo, ruby 1.9.2dev and running Mac 10.5.8.

I have gone into the source and changed it back to load(filename) and it fixes the problem.

Reported by Eric Koslow · March 19th, 2010 @ 10:21 PM

State: resolved
Milestone: none
Assigned to: Aaron Patterson Aaron Patterson
Importance: Low

Activity

  1. Aaron Patterson
    Aaron Patterson
    • Assigned user set to Aaron Patterson

    Are you able to reproduce this with a new application?

    March 20th, 2010 @ 01:32 AM

  2. Aaron Patterson
    Aaron Patterson

    Also, could I possibly get a stack trace from when it had "require"?

    March 21st, 2010 @ 07:11 PM

  3. Evgeniy Dolzhenko
    Evgeniy Dolzhenko

    The problem was indeed introduced by the aforementioned commit, but the cause is that Kernel#require doesn't load relative paths on Ruby 1.9.2 Ruby, while Kernel#load does.

    There is even ticket for that issue: http://redmine.ruby-lang.org/issues/show/2710

    Backtrace:

    > rake --trace db:migrate
    (in /mnt/hgfs/tourism_studies)
     Invoke db:migrate (first_time)
     Invoke environment (first_time)
     Execute environment
     Execute db:migrate
    rake aborted!
    no such file to load -- db/migrate//20100323145036_test_migration.rb
    /mnt/hgfs/tourism_studies/vendor/rails/activesupport/lib/active_support/dependencies.rb:209:in require'
    /mnt/hgfs/tourism_studies/vendor/rails/activesupport/lib/active_support/dependencies.rb:209:inblock in require'
    /mnt/hgfs/tourism_studies/vendor/rails/activesupport/lib/active_support/dependencies.rb:195:in block in load_dependency'
    /mnt/hgfs/tourism_studies/vendor/rails/activesupport/lib/active_support/dependencies.rb:523:innew_constants_in'
    /mnt/hgfs/tourism_studies/vendor/rails/activesupport/lib/active_support/dependencies.rb:195:in load_dependency'
    /mnt/hgfs/tourism_studies/vendor/rails/activesupport/lib/active_support/dependencies.rb:209:inrequire'
    /mnt/hgfs/tourism_studies/vendor/rails/activerecord/lib/active_record/migration.rb:377:in load_migration'
    /mnt/hgfs/tourism_studies/vendor/rails/activerecord/lib/active_record/migration.rb:373:inmigration'
    /mnt/hgfs/tourism_studies/vendor/rails/activerecord/lib/active_record/migration.rb:373:in migrate'
    /mnt/hgfs/tourism_studies/vendor/rails/activerecord/lib/active_record/migration.rb:506:inblock (2 levels) in migrate'
    /mnt/hgfs/tourism_studies/vendor/rails/activerecord/lib/active_record/migration.rb:582:in call'
    /mnt/hgfs/tourism_studies/vendor/rails/activerecord/lib/active_record/migration.rb:582:inddl_transaction'
    /mnt/hgfs/tourism_studies/vendor/rails/activerecord/lib/active_record/migration.rb:505:in block in migrate'
    /mnt/hgfs/tourism_studies/vendor/rails/activerecord/lib/active_record/migration.rb:492:ineach'
    /mnt/hgfs/tourism_studies/vendor/rails/activerecord/lib/active_record/migration.rb:492:in migrate'
    /mnt/hgfs/tourism_studies/vendor/rails/activerecord/lib/active_record/migration.rb:402:inup'
    /mnt/hgfs/tourism_studies/vendor/rails/activerecord/lib/active_record/migration.rb:387:in migrate'</code>
    </pre>
    
    
    And my idea of fix:
    diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb
    index 23e4505..4e7c24a 100644
    --- a/activerecord/lib/active_record/migration.rb
    +++ b/activerecord/lib/active_record/migration.rb
    @@ -374,7 +374,7 @@ module ActiveRecord
           end
    
           def load_migration
    -        require(filename)
    +        require(Pathname(filename).relative? ? Rails.root + filename : filename)
             name.constantize
           end
    
    
    
    

    March 23rd, 2010 @ 03:14 PM

  4. Aaron Patterson
    Aaron Patterson
    • Tag changed from bug, migration, rails3 to bug, migration, patch, rails3

    March 24th, 2010 @ 01:21 AM

  5. Repository