title: How can I pass an array as an argument to a Rake task?
body: <p>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.</p>
  
  <pre><code>task :change_statuses, :ids, :current_status, :new_status do |task, args|
    puts "args were #{args.inspect}"
  end
  </code></pre>
  
  <p>I've tried running the task these ways:</p>
  
  <pre><code># 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]"
  </code></pre>
  
  <p>My <strong>expected</strong> output would be:</p>
  
  <pre><code>args were {:ids=&gt; [1,2,3], :current_status=&gt; 2 , :new_status=&gt; 3}
  </code></pre>
  
  <p>However, my <strong>actual</strong> output in each case is:</p>
  
  <pre><code>args were {:ids=&gt;"[1", :current_status=&gt;"2", :new_status=&gt;"3]"}
  </code></pre>
  
  <p>How can I pass an array to a Rake task?</p>