Forum: Ruby on Rails How to get rid of an ActiveRecord warning "already initialized constant"

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Kad K. (Guest)
on 2009-01-29 20:06
(Received via mailing list)
I need to get a proxy class for a specific AR validation

I reuse a piece of code (from Globalize),  where it's set as a
constant :

module Globalize
  module Model
    module ActiveRecord
      class << self
        def create_proxy_class(klass)
          Object.const_set "#{}Translation",

so in my validation module, I can write :
translation_class = Globalize::Model::ActiveRecord.create_proxy_class
no problem when executing it...

but in my  model unit tests, I execute it many times, and I get the
warning: already initialized constant EnumerationTranslation    (when
my model class is Enumeration of course)

can I delete this constant in my test setup ?  how ?

thanks  fyh

This topic is locked and can not be replied to.