Displaying 1 result from an estimated 1 matches for "create_proxy_class".
2009 Jan 29
0
How to get rid of an ActiveRecord warning "already initialized constant"
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 "#{klass.name}Translation", Class.new
(::ActiveRecord::Base){..}
..
end
so in my validation module, I can write :
translation_class = Globalize::Model::ActiveRecord.create_proxy_class
(self.class)
no problem when executing it...
but in my model unit te...