ActiveRecord automatic quoted identifiers

Is there a way to tell ActiveRecord to automatically quote all
table/column/etc. identifiers in the SQL that it generates? I just
upgraded to MySql 5 and we have a database table named “Release”…
This is a new reserved word. Bummer.

I want ActiveRecord to automatically generate SQL like:

SELECT name FROM Release
instead of:
SELECT name FROM Release

I can use ActiveRecord::Base#set_table_name to deal with this
particular case but it seems like a bit of a hack. Anyone know if
there’s a global setting for this in database.yml or something?

Jeremy

“Jeremy” [email protected] writes:

I can use ActiveRecord::Base#set_table_name to deal with this
particular case but it seems like a bit of a hack. Anyone know if
there’s a global setting for this in database.yml or something?

+1. I was once bitten by using the PostgreSQL reserved word “user” as
column name, which is the only function that can be called without
parentheses. sigh.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs