how to pass multiple parameters to rake task

You can use args.extras to iterate over all the arguments without explicitly stating how many parameters you have.

Example:

desc "Bring it on, parameters!"
task :infinite_parameters do |task, args| 
    puts args.extras.count
    args.extras.each do |params|
        puts params
    end         
end

To run:

rake infinite_parameters['The','World','Is','Just','Awesome','Boomdeyada']

Output:

6
The
World
Is
Just
Awesome
Boomdeyada

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)