From: John Griffiths Date: 2007-11-27T21:04:11+09:00 Subject: Rake Tasks... undefined method `get_alerts' Hi i'm finishing off my RAKE Task to send out alert emails to all the active users, and using RAKE Tasks to do this. I've written a task to do the work and placed this in /lib/utils.rake of my app. running it via... rake RAILS_ENV=development utils:send_alerts --trace works fine... namespace :utils do desc "Find pending alerts and send out emails" task(:send_alerts => :environment) do for alert in Reminder.get_alerts if alert.done = 0 puts "Alert #{alert.title} - #{alert.date}" UserMailer.deliver_reminder(alert) alert.done = 1 alert.save! end end end end all that works fine but the actual task: Reminder.get_alerts when running it, it says: undefined method `get_alerts' for Reminder:Class i can run it via Reminder.find_all but only want to return certain situations, so i've placed the task to do it in my Reminder Model but that doesn't work, tried in the controller or helper but still it doesn't see the method. Any ideas where i should put the 'get_alerts' method? Appreciate it, -- Posted via http://www.ruby-forum.com/.