NeilS
2006-Jul-06 11:33 UTC
[Rails] ActiveRecord''s bundled Transaction::Simple namespace issues?
Hello all. I''m working on a program that uses both ActiveRecord and PDF::Writer. The latter requires the Transaction::Simple module, and ActiveRecord contains a "built-in" copy of Transaction::Simple - but the namespaces appear to clash, if I''m understanding things correctly. (I''m a bit of a ruby nuby, so please excuse me if I''m misunderstanding this issue.) A brief demo: irb(main):001:0> require ''active_record'' => false irb(main):002:0> require ''transaction/simple'' c:/ruby/lib/ruby/gems/1.8/gems/transaction-simple-1.3.0/lib/transaction/simple.r b:74: warning: already initialized constant Messages c:/ruby/lib/ruby/gems/1.8/gems/transaction-simple-1.3.0/lib/transaction/simple.r b:274: warning: already initialized constant TRANSACTION_SIMPLE_VERSION c:/ruby/lib/ruby/gems/1.8/gems/transaction-simple-1.3.0/lib/transaction/simple.r b:635: warning: already initialized constant TRANSACTION_CHECKPOINT c:/ruby/lib/ruby/gems/1.8/gems/transaction-simple-1.3.0/lib/transaction/simple.r b:636: warning: already initialized constant SKIP_TRANSACTION_VARS => false Are these warnings nothing to worry about, or are they signs of a potential future problem? I realise this is related to ticket 4732 (http://dev.rubyonrails.org/ticket/4732) However, I assume that the reason ActiveRecord physically includes Transaction::Simple is so that if future releases of the latter are incompatible, ActiveRecord won''t break? But say an incompatible version were to be released, would requiring a module that requires ''transaction/simple'' then break ActiveRecord? (Hopefully I''m making myself clear here!) Ticket 4732 wouldn''t fix that problem, as I understand it. (And wouldn''t fix the problem of loading ActiveRecord before PDF::Writer?)>From my nuby position, it would seem safer if ActiveRecord''s copy ofTransaction::Simple was in its own module namespace to prevent these type of problems. I''m not sure if this is a minor tweak or a major change? Any comments would be appreciated. Regards, NeilS. P.S. The same issues may or may not apply to the other modules (MySql/DB2) in ActiveRecord''s vendor directory; I haven''t investigated. -- Posted via http://www.ruby-forum.com/.