Constant redefinition warning


I get a redefinition warning :

log warning =>
validations.rb:18: warning: already initialized constant

I am using the following code, apps is running well w warning
module Validations
def validate_translation_uniqueness_of(*attr_names)
translation_class = Object.const_set “#{}Translation”,{}

I tried now to avoid it writing :
translation_class = Object.const_set “#{}Translation”,{} unless defined?("#{}
but it fails … (obviously don’t like a string…)

I also tried:
translation_class = Object.const_set “#{}Translation”,{} unless defined?("#{}

“#{}Translation”.to_sym => :AccountingPeriodTranslation
which is also bad…

I need to have : #{}Translation giving a class , how
should I write it ?

defined?(AccountingPeriodTranslation) =>“constant” is what I should
test (or any other xxxxTranslation class where xxxx is self.class

thanks for your help



I changed the creation + test to a simple get constant as it’s already
declared (being an ActiveRecord class created by Globalize plugin)

a simple :

globalize_class = Object.const_get “#{}Translation”

gives me the class…