TAGS :Viewed: 5 - Published at: a few seconds ago

[ How can I check if DataMapper is connected? ]

Active Record has a method called connected? that returns true if Active Record is connected. Is there an equivalent for DataMapper? I can't find anything in the API docs. And if not, what is the most proper solution to check this?

Answer 1

DataMapper is multi-adapter ORM and expects each adapter to maintain connection to it's database. Some adapters even have no connection, like yaml or in-memory. So, generally, you can't know if DataMapper connected or not.