2

rake tasks allow to define a list of other tasks that need to run before as a prerequesite, i.e.

namespace :import do 
 task :products => [:environment, :tax_categories] do
   ... # create products from import and reference tax categories
 end
end

However, how could i reference the tax_categories task if it was defined in another namespace, like

namespace :init do
 task :tax_categories => :environment do
   ... # create tax categories
 end
end

Thanks for the help.

fgro
  • 33
  • 4

1 Answers1

3

You could probably do this, but dont know if this is the recommended way:

namespace :import do 
 task :products => [:environment, "init:tax_categories"] do
   ... # create products from import and reference tax categories
 end
end
rubyprince
  • 17,559
  • 11
  • 64
  • 104