# How can I detect from the controller which database adaptor is in use?

**URL:** <https://www.ruby-forum.com/t/how-can-i-detect-from-the-controller-which-database-adaptor-is-in-use/125335>\
**Category:** Rails\
**Created:** [January 8, 2008, 11:41am UTC](https://www.ruby-forum.com/t/how-can-i-detect-from-the-controller-which-database-adaptor-is-in-use/125335 "2008-01-08T11:41:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jose](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@jose](https://www.ruby-forum.com/u/jose)\
**Post date:** [January 8, 2008, 11:41am UTC](https://www.ruby-forum.com/t/how-can-i-detect-from-the-controller-which-database-adaptor-is-in-use/125335/1 "2008-01-08T11:41:41Z")

</div>

I’m using Postgres in development and MySQL in production. They use  
different SQL syntax in some places in my code.

How can I detect from the controller which adaptor is in use?

I’ll be migrating the production site to Postgres, so switching to  
MySQL in development isn’t an option.

Thanks,  
Jose

---

<div class="post-metadata">

**Author:** ![jose](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@jose](https://www.ruby-forum.com/u/jose)\
**Post date:** [January 8, 2008, 11:49am UTC](https://www.ruby-forum.com/t/how-can-i-detect-from-the-controller-which-database-adaptor-is-in-use/125335/2 "2008-01-08T11:49:52Z")

</div>

On Jan 8, 2:40 am, HG [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m using Postgres in development and MySQL in production. They use  
> different SQL syntax in some places in my code.
> 
> How can I detect from the controller which adaptor is in use?

Got it. Model#connection.adapter\_name
