I'm planning to write the rake task to query few details from the model and sending the notification using ActionMailer object
I'm getting below error when I invoke the action mailer class in my rake task,
rake aborted!
#<NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]>
C:/Rails application/TEST/lib/tasks/notifier.rak
My code:
notifier.rake file under lib/tasks
task :notify => :environment do
begin
**************
Notifier.deliver_submitted_list_notification(email_settings[RAILS_ENV], records )
end
notifier.rb model/notifier.rb
class Notifier < ActionMailer::Base
def submitted_list_notification(settings,records)
**********
end
end
Any help would be appreciated!!