Model not found in custom script

Hello,

I have a custom task_scheduler.rb file in RAILS_ROOT/configuration/
initializers.

It fails because I think that it doesn’t know where to find my
Category model.

Do you know how I can load or have available the resources/environment
that myrails app uses into this script?

Thanks,

Frank

task_scheduler.rb

require ‘rss’
require ‘rubyful_soup’
require ‘tmail’
require ‘rufus/scheduler’

scheduler = Rufus::Scheduler.start_new

scheduler.every(“1m”) do
@categories = Category.find(:all)

for category in @categories
rebuild_category_rss_data(category.id)
end
end

Do you know how I can load or have available the resources/environment
that myrails app uses into this script?
It should happen automatically. Can you post the error message and stack
trace?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs