Passing Arguments To A Rake Task
You can create a rake task that takes arguments by including an array of named arguments in the task declaration.
task :greeting, [:name] do |task, args|
  puts "Hello, #{args.name}!"
endYou can then pass an argument to that task when invoking it.
$ rake greeting[World]
Hello, World!Last updated
Was this helpful?