1

Where is the best place initialize a Singleton in Rails?

I am using the Carrot AMQP library in a Ruby on Rails app and I only want to initial the settings once and not on every task that is generated.

I currently have it in my environment.rb and it seems to work but I am not entirely sure this is the best place.

Is having Carrot initialized only once Rails has booted even a good idea or should I create a new Carrot object for every task that is created?

hacintosh
  • 3,784
  • 4
  • 19
  • 22

1 Answers1

1
# config/initializers/carrot.rb

require 'carrot'
#set some carrot settings
yfeldblum
  • 65,165
  • 12
  • 129
  • 169