Skip to content
  • Jonathan Hefner's avatar
    85c5e829
    Load Rails Rake tasks only once · 85c5e829
    Jonathan Hefner authored
    In #39137, a new `Rake::Application` instance was created per Rake
    command invocation.  To ensure that the Rails tasks were defined for
    each `Rake::Application`, `rails/tasks.rb` was loaded per instance.
    However, `Rake::Application#load_rakefile` loads the application's
    Rakefile, which should invoke `Rails.application.load_tasks`, which, in
    turn, also loads the Rails tasks.  When a Rake task is defined more than
    once, all definition blocks are executed when the task is run.  Hence,
    Rails task blocks were being executed twice.
    
    This commit removes the unnecessary load and avoids double execution.
    
    Fixes #40136.
    85c5e829
    Load Rails Rake tasks only once
    Jonathan Hefner authored
    In #39137, a new `Rake::Application` instance was created per Rake
    command invocation.  To ensure that the Rails tasks were defined for
    each `Rake::Application`, `rails/tasks.rb` was loaded per instance.
    However, `Rake::Application#load_rakefile` loads the application's
    Rakefile, which should invoke `Rails.application.load_tasks`, which, in
    turn, also loads the Rails tasks.  When a Rake task is defined more than
    once, all definition blocks are executed when the task is run.  Hence,
    Rails task blocks were being executed twice.
    
    This commit removes the unnecessary load and avoids double execution.
    
    Fixes #40136.
Loading