I am getting the following error running my rake task
rake store_reports["1", "2"]
rake aborted!
Don't know how to build task 'store_reports[1,'
My rake task takes 2 parameters and needs to access models inside it. Here is the task
task :store_reports, [:start_date, :end_date] => :environment do |t, args|
puts args.start_date
end
I referenced both of there stackoverflow questions, but the first answer did not work, and in the second one the author seems to have solved it but he never posted his answer.
rake aborted! undefined method `map' for :name:Symbol rake task with multiple parameters - I got stuck
Heres some extra info. Where I run rake -T
I dont see my rake task there
So I decided to write about it here. If you want to write your own rake task you have 2 ways to do it (I thought so before): Write it from scratch. Copy-paste code from another ready rake task and change code to required.
Rake is a software task management and build automation tool created by Jim Weirich. It allows the user to specify tasks and describe dependencies as well as to group tasks in a namespace. It is similar in to SCons and Make.
Go to Websites & Domains and click Ruby. After gems installation you can try to run a Rake task by clicking Run rake task. In the opened dialog, you can provide some parameters and click OK - this will be equivalent to running the rake utility with the specified parameters in the command line.
try
rake store_reports["1","2"]
as per How to pass command line arguments to a rake task.
the parser is not liking the space between your parameters
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With