I'm running a Rails 3 app using Authlogic 2.1.6. I've added a cron task that
will not execute. It errors out with this:
$ heroku rake cron
(in /app)
start sending reminder emails
rake aborted!
uninitialized constant Object::Event
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'
/app/lib/tasks/cron.rake:5:in `block in <top (required)>'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:634:in `call'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:629:in `each'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:629:in `execute'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:595:in `block in
invoke_with_call_chain'
/usr/ruby1.9.2/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:581:in `invoke'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in
top_level'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2019:in `each'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2013:in `top_level'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:1992:in `run'
/usr/ruby1.9.2/bin/rake:31:in `<main>'
The cron is quite simple:
desc "This task is called by the Heroku cron add-on"
task :cron => :environment do
begin
puts "start sending reminder emails"
Event.send_reminders
puts "finished sending reminder emails"
end
end
and Event.send_reminders should sent out reminder emails as requested by the
users.
After going back a forth with Heroku support for a few days, the conclusion
was that the cron is ok and the problem is likely somewhere in the Rails
setup...
So I created a new basic app on Heroku, with an Event model and a simpler
send_reminder method that just accesses the database. This works. Then when
I add my Authlogic code for registration/login/password reminder and try the
cron again, it fails with the same error as shown above.
I should add that the Authlogic gem is included in the Gemfile right off the
bat and doesn't cause any problems until I add in the code that utilizes
Authlogic.
I have tried including this in the cron file:
require '../../app/models/event'
and other variations to make sure the event.rb file is being found, but none
of that worked either.
Any help greatly appreciated.
--
You received this message because you are subscribed to the Google Groups
"Heroku" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en.