I'm deploying my rails application on a shared host, using mysql. During development, however, I'm using an sqlite database. My queries need to work on both these environments. I'd earlier asked about a query using concat that'd work on both databases: Can MySQL concatenate strings with ||
I was told that I should set sql_mode to PIPES_AS_CONCAT or ANSI. Now my question is where and how should I set sql_mode in my application. Can it be done as an initializer, so as not to change my general code?
I tried using the code snippet from here: http://gabrito.com/post/configuring-mysql-sql-mode-in-ruby-on-rails, but that didn't work - I'm guessing the connect method has since changed as that post is rather old.
Any help is much appreciated. I'm using rails 3.1.3, by the way.