This project is archived and is in readonly mode.

#4240 ✓resolved
Eric Koslow

Migration now points to db/migrate//

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

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.

Comments and changes to this ticket

  • Aaron Patterson

    Aaron Patterson March 20th, 2010 @ 01:32 AM

    • Assigned user set to “Aaron Patterson”

    Are you able to reproduce this with a new application?

  • Aaron Patterson

    Aaron Patterson March 21st, 2010 @ 07:11 PM

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

  • Evgeniy Dolzhenko

    Evgeniy Dolzhenko March 23rd, 2010 @ 03:14 PM

    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
    
    
    
    
  • Aaron Patterson

    Aaron Patterson March 24th, 2010 @ 01:21 AM

    • Tag changed from bug, migration, rails3 to bug, migration, patch, rails3
  • Repository

    Repository March 24th, 2010 @ 01:23 AM

    • State changed from “new” to “resolved”

    (from [ed21f0c50270139ddb6993acfdaea4586ffd09a3]) expand migration paths before requiring them. [#4240 state:resolved]

    Signed-off-by: wycats wycats@gmail.com
    http://github.com/rails/rails/commit/ed21f0c50270139ddb6993acfdaea4...

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages