rails/rails — pull request #11014 by senny (2013-06-19 16:39:45+00:00)
Title: `inspect` for AR model classes does not initiate a new connection.

Closes #10936

The behavior of `Model.inspect` with a missing database connection was different for each adapter:

**sqlite3**
```
irb(main):001:0> User.inspect
=> "User(Table doesn't exist)"
```

**postgresql**
```
irb(main):001:0> User.inspect
PG::Error: FATAL: database "i_do_not_exist" does not exist
```

**mysql2**
```
irb(main):001:0> User.inspect
Mysql2::Error: Access denied for user 'myuser'@'localhost' (using password: YES)
```

This patch changes the implementation of `inspect` to not initiate a connection and simply return "not connected" if no connection is established. This prevents the exceptions on inspect and should still be expressive enough.