【发布时间】:2023-03-03 17:15:01
【问题描述】:
典型的 rake 任务定义如下所示:
desc "Set the environment value for the database"
task "environment:set" => [:environment, :load_config] do
ActiveRecord::InternalMetadata.create_table
ActiveRecord::InternalMetadata[:environment] = ActiveRecord::Migrator.current_environment
end
但是如果它没有desc,我想稍后在运行时添加它,在任务定义的文件执行之后。像desc "this is the documentation", task: :taskname 这样的东西。这可能吗?
【问题讨论】:
-
看起来这里的方法实现了覆盖 desc 和行为:metaskills.net/2010/05/26/…