[Rails] Bug in per model connections ?
Daniel Hobe
daniel at nightrunner.com
Tue Nov 2 03:45:51 GMT 2004
I've been using per model connections for a project and I think I've run
into a but in AR. Everything is fine until I go to save my changes back
to the database (in my case Postgres). At that point I get a
ConnectionNotEstablished exception. From what I've been able to track
down it looks like the bug is on line 97 of
lib/active_record/transactions.rb:
def save_with_transactions(perform_validation = true) #:nodoc:
....
---> ActiveRecord::Base.transaction { result =
save_without_transactions(perform_validation) }
....
end
It seems using ActiveRecord::Base.transaction rather than
myModel.transaction is causing the lookup of an established connection
in Thread.current['active_connections'] to try and find a connection for
ActiveRecord::Base rather than myModel.
Has anyone else seen this?
--
Daniel Hobe <daniel at nightrunner.com>
http://www.nightrunner.com
More information about the Rails
mailing list