Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

has_many_polymorphs fails with Postgres DB and columns with capitalized letters #12

Open
pr0zac opened this issue Mar 15, 2010 · 0 comments

Comments

@pr0zac
Copy link

pr0zac commented Mar 15, 2010

I've been creating a rails project using has_many_polymorphs to create associations between models. Some of these models store data in columns directly related to keys in incoming/outgoing plists. This has resulted in some of the columns having capitalized names. Unfortunately, postgres automatically lowercases all characters in passed column names unless they are correctly double quoted. In its current form, has_many_polymorphs does not correctly handle this case. The error looks similar to this:

CollectionsMember Load (0.0ms) PGError: ERROR: column devices.udid does not exist
LINE 1: ...S t0_r2, collections_members.updated_at AS t0_r5, devices.Udid...

I have managed to force things to work correctly by adding quotes around column names in base.rb, function instantiate_with_polymorphic_checks, and in class_methods.rb, function build_table_aliases, though this is likely just a stop gap, as I haven't tested its effects on any other databases, and not fit for actual integration.

This issue likely effects a lot more people than just me, as this seems like a pretty common use case, and can hopefully be addressed quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant