0

我在(Rails.root/lib/tasks/me.rake)的rails应用程序中有以下内容:

task :abc do
  puts "here is abc"
end

并且可以致电:

rake abc # works

但以下不起作用:

irb> rake :abc # doesn't work
bash>rake -T # doesn't show up

也不:

describe 'query task061', task061:true do
  it 'should query' do
    FactoryGirl.create(:location2)
    Q.count.should == 1
    rake['abc'].invoke
  end
end

我还需要做什么才能允许以这些方式调用任务?

谢谢

4

1 回答 1

0

对任务进行描述,看看它是否有效,应该是,

desc "your task desc"
task :abc do
  puts "here is abc"
end
于 2013-10-23T23:02:06.770 回答