LoginSignup
8
6

More than 5 years have passed since last update.

rake task で配列を渡す

Posted at

args.extrasではみ出た引数を配列で受け取れる

$ bundle exec rake 'hoge[1,2,3,4,5,6]'
rake_task.rb
task :hoge, [:id] => :environment do |_t, args|
  ids = [args[:id], args.extras].flatten
end
8
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
6