2014-05-07 41 views

回答

0

rails g task發生器不能這樣工作。

這裏是爲TaskGenerator

module Rails 
    module Generators 
    class TaskGenerator < NamedBase # :nodoc: 
     argument :actions, type: :array, default: [], banner: "action action" 

     def create_task_files 
     template 'task.rb', File.join('lib/tasks', "#{file_name}.rake") 
     end 

    end 
    end 
end 

代碼正如你所看到的lib/tasks路徑是硬編碼的,你不能選擇通過改變路徑。

我認爲這可能是TaskGenerator類的一個很好的補充。

您的問題的答案是,您必須手動創建文件夾。

+0

這是我所期望的嗎? – sasikkumar

+0

對不起,爲什麼是問號。你有期待嗎?請接受以備將來參考。 –

相關問題