Importing application constants into models and backgroundrb workers - How To?

Hi,

  I have an app_constants.rb file for defining my constants.   I need the same constants for checking conditions with my models and backgroundrb workers.

  When i tried require "app_constants" in my models files it doesn't suggest any errors but i was unable to use   the constants either

  Any suggestions???

Regards, Vimal Das

requiring your file should make them available for your models. there is something wrong with your code.

# file.rb CONSTANT = "loaded"

# some_model.rb class SomeModel < ActiveRecord::Base   require File.dirname(__FILE__) + '/some/path/to/your/file'   def self.constant_status     puts CONSTANT   end end

# script/console

SomeModel::constant_status

loaded => nil

Cool.Thank you.

:slight_smile: Vimal Das