Schedule Tasks Using ‘Whenever’ Gem- Ruby on Rails
Hima Chitalia
1412

Thanks, Hima. Leaving aside the scheduling of the task, I am getting an error when I run the rake task. My task calls a model method:

task fetch: :environment do
 Currency.connection # Appears to be required
 Currency.get_rates
end

and the model is defined as follows:

class Currency < ApplicationRecord
 def get_rates
 # Grab rates from API here
 end
end

But running the task generates this error:

NoMethodError: undefined method `get_rates’ for #<Class:0x00000000088a5798>

Do you have any suggestions?