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’
irb(main):002:0> require ‘transaction/simple’
b:74: warning: already initialized constant Messages
b:274: warning: already initialized constant TRANSACTION_SIMPLE_VERSION
b:635: warning: already initialized constant TRANSACTION_CHECKPOINT
b:636: warning: already initialized constant SKIP_TRANSACTION_VARS
Are these warnings nothing to worry about, or are they signs of a
potential future problem?
I realise this is related to 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 of
Transaction::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
Any comments would be appreciated.
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.