-
Notifications
You must be signed in to change notification settings - Fork 179
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
primary_key unsettable with has_many #60
Comments
This seems like an intuitive patch. Before I think about how it might be implemented, could you just use the abbreviation as the id? That is, do you store the id anywhere in the db? ActiveHash should work fine with string ids (see https://github.com/zilkey/active_hash/blob/master/spec/active_hash/base_spec.rb#L366) Would that suit your current situation? |
This'd be great. We're migrating a bunch of databased based models to use ActiveHash, and this would help us simplify the transition. |
Released in v1.2.0 |
Woo! Thanks @tomtaylor 👍 |
foreign_key
works just fine, but primary_key always usesid
.Given the following:
The following will fail because it looks for the value
id
and notabbrev
The above would run something like:
When it should run:
I believe it should be fairly easy to add it to
lib/associations/associations.rb
but I'm pretty green and unsure of all the implications.The text was updated successfully, but these errors were encountered: