composite-primary-keys/composite_primary_keys — pull request #183 by AndyObtiva (2014-04-07 00:56:04+00:00)
Title: Added alias support for primary_keys= to be used as primary_key= 

A colleague of mine and I encountered a small hick-up using this gem a couple of days ago because we initially mistyped self.primary_keys= as self.primary_key=, and as such, could not pass it an array of columns. It took about 10-15 minutes to notice we needed to type self.primary_keys= to fix. I think this might be a sign that the API has room for improvement given our unconscious thinking that a "composite key" is just a single Rails primary key (not plural according to http://www.techopedia.com/definition/6572/composite-key though has plural columns). Since it is singular, it seemed valid to both of us to contribute a patch that allows self.primary_key= to be used as an alias (alternative option) for self.primary_keys= to better map it to the way developers think about a composite key.

Thanks for providing "composite key" support for ActiveRecord for many years. I have found this gem invaluable in previous projects dealing with legacy databases. I'm surprised the Rails folks haven't incorporated this into Rails directly. I assume it is because of the "convention over configuration" principle. Still, I think this is greatly useful even in modelling new databases.

Regards,

Andy