Rails how to run rake task

前端 未结 6 1342
傲寒
傲寒 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:14

    In rails 4.2 the above methods didn't work.

    1. Go to the Terminal.
    2. Change the directory to the location where your rake file is present.
    3. run rake task_name.
    4. In the above case, run rake iqmedier - will run only iqmedir task.
    5. run rake euroads - will run only the euroads task.
    6. To Run all the tasks in that file assign the following inside the same file and run rake all

      task :all => [:iqmedier, :euroads, :mikkelsen, :orville ] do #This will print all the tasks o/p on the screen 
      end
      

提交回复
热议问题