I'm calling a rake task within a task and I'm running into a roadblock when it comes to calling execute
response = Rake::Task["stuff:sample"].execute[:match => "HELLO"]
or
response = Rake::Task["stuff:sample"].execute[:match => "HELLO",:freq=>'100']
Calling task
task :sample, [:match,:freq] => :environment do |t, args|
The error I get back is 'can't convert Hash into Integer'
Any ideas?
I think the problem is in code you're not posting. Works fine for me:
The square brackets in your execute syntax confuse me. Is that a special rake syntax (that you may be using incorrectly) or do you mean to send an array with one element (a hash)? Isn't it the same as this?
Beyond that,
Task#execute
expects Rake:TaskArguments.You could use:
You could also use Task#invoke, which will receive basic args. Make sure you
Task#reenable
if you invoke it multiple times.