views:

113

answers:

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?

+1  A: 
# config/initializers/carrot.rb

require 'carrot'
#set some carrot settings
Justice