Search code examples
ruby-on-railsrubytaskjobsruby-on-rails-6

Custom rails task not showing up/loading in rails 6


In rails-myapp/lib/tasks I have a custom task called orders.rake:

namespace :orders do
    desc "fetch orders" do
        task :fetch do
           # come code
        end
    end
end 

My understanding, this task should be available in the list when running rails -T.

I'm seeing this:

rails notes # fetch orders

Not sure this why the word of notes is showing up.

I supposed to be able to run this task by:

rails orders:fetch


Solution

  • Try so:

    namespace :orders do
      desc "fetch orders"
      task :fetch do
        # come code
      end
    end
    

    Then:

    rake orders:fetch
    

    rake notes is a task that shows your TODO list