Rails how to run rake task

前端 未结 6 1354
傲寒
傲寒 2020-12-23 15:30

How do I run this rake file in terminal/console?

my statistik.rake in lib/tasks

desc \"Importer statistikker\"
namespace :reklamer do
  task :iqmedie         


        
6条回答
  •  忘掉有多难
    2020-12-23 16:20

    You can run Rake tasks from your shell by running:

    rake task_name
    

    To run from from Ruby (e.g., in the Rails console or another Rake task):

    Rake::Task['task_name'].invoke
    

    To run multiple tasks in the same namespace with a single task, create the following new task in your namespace:

    task :runall => [:iqmedier, :euroads, :mikkelsen, :orville] do
      # This will run after all those tasks have run
    end
    

提交回复
热议问题