我想为每个模型运行任务,如下所示:
task all: :environment do
resources = [ Question,
Answer,
Link,
Event,
PastEvent,
Review ]
resources.each do |resource|
#Rake::Task["tire:import CLASS=#{resource} FORCE=true"].execute
system "rake environment tire:import CLASS='#{resource}' FORCE=true"
end
end
有更好的使用方法system
吗?