Open jarl-dk opened 14 years ago
Seems like the formatting of the monkey patch went wrong: class ActiveRecord::ConnectionAdapters::UnitRecordAdapter def indexes(table_name, name = nil) [] end end
Thanks for reporting this bug. Which version of Rails / ActiveRecord?
Rails version 2.3.5 activerecord 2.3.5
Notice that unit_record is intercepting calls to the adapter, and aparently when using postgresql adapter (and aparently only when using postgresql adapter) activerecord directly (or indirectly) calls a #indexes method.
I have no idea why.
Dan, do you have any updates on this issue?
I'll get this fixed and released this week.
Hi. I am using postgresql.
Now I wanted to use unit_record to speed up my tests. However I realise that it fails with NoMethodError: undefined method `indexes' for #ActiveRecord::ConnectionAdapters::UnitRecordAdapter:0x7fa18f27ba90
It seems like the postgresql_adapter implements this method, and it is called when invoking ActiveRecord::Base#Count
However If I monkeypatch like this (in unit_test_helper.rb) class ActiveRecord::ConnectionAdapters::UnitRecordAdapter def indexes(table_name, name = nil) [] end end
I get the correct behaviour "RuntimeError: ActiveRecord is disconnected; database access is unavailable in unit tests."