I have a rake task
namespace :authentication do
desc "Automatically runs authentication tester"
task :tester => :environment do
begin
Auth.perform
rescue
SystemEvent.error(50049, "Authentication Tester Finished Unsuccessfully.")
end
end
end
in my Auth.perform, I have used,
Customer.first.symbol
I am loading Customer from database. But it always comes to the rescue block saying
undefined method 'symbol' for nil:class
In my application.rb
config.autoload_paths += Dir.glob("#{Rails.root}/lib/**/*").select{|d| File.directory?(d)}
config.autoload_paths += Dir.glob("#{Rails.root}/app/models/**/*").select{|d| File.directory?(d)}
config.autoload_paths += ["#{Rails.root}/services/"]
This calls Auth.perform in development. Only in production it comes to rescue block. Is this something because I am missing?
require 'rake'
Please provide a solution. It has been one week I am picking my head.
Please Note: this rake task is called by a cron running in another instance.