By default ActiveRecord always quote table name for the generated SQL.
For example set_table_name ‘CUSTOMER_ACCOUNT’
Then it generate sql like , SELECT * FROM “CUSTOMER_ACCOUNT”
This is an issue for the PostgreSQL database which gives table doesn’t
exist error.
How could generate a sql using ActiveRecord without quotes?
in postgres table name (in general name of every db objects)
is case insensitive, but if you use “” to quote string postgres
become case sensitive.
to make a long story short use lower case in your model i.e.
set_table_name ‘my_table’
Em Qui, 2013-04-11 às 04:08 +0900, Biju jaaaa escreveu:
By default ActiveRecord always quote table name for the generated SQL.
For example set_table_name ‘CUSTOMER_ACCOUNT’
Then it generate sql like , SELECT * FROM “CUSTOMER_ACCOUNT”
This is an issue for the PostgreSQL database which gives table doesn’t
exist error.
How could generate a sql using ActiveRecord without quotes?
Isn’t that an issue about UPER_CASE_NAME? What if you do:
set_table_name ‘customer_account’
?
Btw, this is more related to Rails guys than to Ruby ones.