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

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

and the model is defined as follows:

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

But running the task generates this error:

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

Do you have any suggestions?