Open fun-ruby opened 8 years ago
Just ran into the same issue. +1 for a solution along the lines of lowercase_schema_reflection.
if you guys need it than you should look into porting it over to AR-JDBC - we can not handle feature request (esp. for lesser used adapters such as MS-SQL) out of the box.
I am migrating an existing system that is using activerecord-sqlserver-adapter over to activerecord-jdbcmssql-adapter. The legacy database has all uppercase column names and was addressed with using an initializers configuration:
ActiveRecord::ConnectionAdapters::SQLServerAdapter.lowercase_schema_reflection = true
As far as I can tell there isn't an equivalent setting in activerecord-jdbcmssql-adapter. Please correct me if I am mistaken.
Since column_names are in uppercase, accessing attribute names in lowercase no longer works. I also observed setting the primary_key column name (in lowercase) have unintended result.
class Foo < ActiveRecord::Base self.primary_key = "foo_id" end
Foo.column_names => ["FOO_ID", ...] foo.attributes => {"FOO_ID" => 123, "foo_id" => nil}
This causes AR association look up to fail to find a match. For example, bar.foo => nil.
There are work-arounds but I was hoping for an equally elegant solution as with lowercase_schema_reflection.
Currently looking at aliasing column_names with lowercase equivalent, plus uppercasing all primary_key values.
Thanks in advance for any ideas.
Long
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.