Search code examples
ruby-on-railsrubysequeltiny-tds

How to Keep Original Column Names with Sequel


I have database with upper camelCase naming conventions eg. MyColumn. When using the Sequel gem in my rails app to access the database the column is renamed to mycolumn as a model variable name or hash key. How can I preserve the original database column names in my code?

I am using a SQL Server DB with tiny-tds adapter. I am also using the sequel-rails gem.


Solution

  • You can modify the default mangling on MSSQL by using the identifier_mangling extension:

    DB.extension(:identifier_mangling)
    DB.identifier_input_method = DB.identifier_output_method = nil