DelayedJob class model should be named delayed_job #17

Closed
otaviofcs opened this Issue Dec 10, 2009 · 3 comments

2 participants

@otaviofcs

Hy all, I'm having a really hard time trying to create an observer for delayed_job. I want to create a job watcher that will inform the different accounts that there are tasks running on back ground.

class DelayedJobObserver < ActiveRecord::Observer
  observe Delayed::Job
  def after_destroy(job)
    job_watcher = JobWatcher.find_by_job_id job.id
    job_watcher.destroy
    true
  end
end

Whenever I try to call DelayedJobObserver.observed_class, it keeps throwing:

LoadError: Expected ~/MY_APP/vendor/plugins/delayed_job/lib/delayed_job.rb to define DelayedJob

I guess it's the model class name out of standard that is causing it. Any hints?

@otaviofcs

In order to succeed with my intent I have changed the model a little bit, by renaming the delayed_jobs table to simply jobs. I do understand that it won't be easy to rename it to jobs (because there might have some apps already using this table name), but it respects more the rails code conventions. Alternatively, it's possible to rename Jobs class and change table name to a mode convenient name.

@otaviofcs

I'm closing this issue because I rewrote with the old table name and it's working. I've checked on git and I just can't figure out where I had messed up the code.

@tobi
Owner

Yea i think this is because of rails reloading.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment