Why this doesn't work?

ActiveRecord::Base.connection.execute("\\d") ?

Because you're confusing commands the the psql application supports
versus actual sql queries you can run. Execute lets you run arbitrary
sql expressions, which "\\d" isn't (it also doesn't do much with the
result for you, so select_all etc... are often more useful if there is
data you are trying to get at)


(PS: ActiveRecord::Base.connection.tables)