This is the rake task I am trying to run
desc "This task changed the status of started jobs"
task :start_status => :environment do
jobs_to_be_started = Job.find_all_by_status("Started")
jobs_to_be_started do |job|
job.status = "Running"
job.saved
end
end
And this is the error I am receiving
Rake aborted! undefined method `jobs_to_be_started' for main:Object
Have had a google and can’t see an obvious answer, can anyone point me in the right direction?
Probably you’ve missed an iterator (
eachfor example)?And also you will probably get an error on job.saved, is that a misprint? i would suggest you to use
update_attributeshere, like