jeudi 29 octobre 2020

Uppercase column names from MYSQL

Have an external MYSQL DB and I am connecting it to the ruby app. All the columns are changes to uppercase and when I try to query something it works but ruby gives an undefined method error when i try to call some field from the object like:

user = User.first works but when i do user.firstname it says undefined method firstname because the user object I get has firstname column as FIRSTNAME. How can I make it a case-incentive query so either i do user.firstname or user.FIRSTNAME it works?

i tried adding ActiveRecord::ConnectionAdapters::SQLServerAdapter.lowercase_schema_reflection = true into my cofig/initializers/activereport_sqlserver_adapter.rb but still no change.

Aucun commentaire:

Enregistrer un commentaire