Ruby on rails 未将参数传递给Rake任务

Ruby on rails 未将参数传递给Rake任务,ruby-on-rails,arguments,rake,task,Ruby On Rails,Arguments,Rake,Task,我有一个rake任务,它接受一个参数:scope(如下)。 我这样称呼rake任务: rake podcast:generate_inventory["new"] 这个任务过去可以完美地传递:scope arg,但是,我今天注意到arg不再被传递。有人知道为什么会这样吗 namespace :podcast do task :itunes_top_300, [:scope] => :environment do |t,args| Podcast.podcast_logger

我有一个rake任务,它接受一个参数:scope(如下)。 我这样称呼rake任务:

rake podcast:generate_inventory["new"]
这个任务过去可以完美地传递:scope arg,但是,我今天注意到arg不再被传递。有人知道为什么会这样吗

namespace :podcast do

  task :itunes_top_300, [:scope] => :environment do |t,args|
    Podcast.podcast_logger.info("BEGIN: #{Time.now}")
    if args[:scope] == "new"
      Podcast.podcast_logger.info("NEW PODCASTS ONLY")
    end
    Podcast.itunes_top_rss
  end

  task :itunes_genres_top_300 => :itunes_top_300 do
    Podcast.itunes_genre_rss
  end

  task :site_and_feed_discovery, [:scope] => :itunes_genres_top_300 do |t,args|
    if args[:scope] == "new"
      Podcast.site_and_feed_discovery(:new_podcasts_only => true)
    else
      Podcast.site_and_feed_discovery
    end
  end

  task :social_discovery, [:scope] => :site_and_feed_discovery do |t,args|
    if args[:scope] == "new"
      Podcast.social_discovery(:new_podcasts_only => true)
    else
      Podcast.social_discovery
    end
  end

  task :fetch_episodes => :social_discovery do |t,args|
    Episode.episode_logger.info("BEGIN: #{Time.now}")
    Podcast.fetch_episodes
    Episode.episode_logger.info("END: #{Time.now}")
  end

  task :generate_inventory => :fetch_episodes do |t,args|
    Podcast.podcast_logger.info("Successful Rake")
    Podcast.podcast_logger.info("END #{Time.now}")
    Rake::Task['maintenance:daily'].invoke
  end
end

看起来您在定义
task:generate\u inventory
时缺少了
[:scope]
位。我怀疑再加上这些会解决一切问题


希望有帮助

多谢泽维尔。工作得很有魅力:)