I'm writing a Rake task and I want to pass an array as one of the arguments. Here's how I currently have it.

task :change_statuses, :ids, :current_status, :new_status do |task, args|
  puts "args were #{args.inspect}"
end

I've tried running the task these ways:

# First argument as array
rake "change_statuses[[1,2,3], active, inactive]"

# First argument as string
rake "utility:change_account_statuses['1,2,3', foo, bar]"

My expected output would be:

args were {:ids=> [1,2,3], :current_status=> 2 , :new_status=> 3}

However, my actual output in each case is:

args were {:ids=>"[1", :current_status=>"2", :new_status=>"3]"}

How can I pass an array to a Rake task?

Edit
Report