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

ID is excluded? #15

Open
matt17r opened this issue Nov 30, 2018 · 0 comments
Open

ID is excluded? #15

matt17r opened this issue Nov 30, 2018 · 0 comments

Comments

@matt17r
Copy link

matt17r commented Nov 30, 2018

I'm looking for a solution to be able to write a column named 'ID' (which isn't the primary key) in an external database.

I noticed in the README it says

Instance methods in ActiveRecord::Base, except for 'id', are combined into a list

Is there any reason why id is excluded? Is id= excluded too?

So far my best (only) solution is to monkey patch ActiveRecord::AttributeMethods::Write.write_attribute(attr_name, value) and then access it using square brackets:

external_object = ExternalObject.new(mapped_attributes_other_than_person_id)
external_object[:id] = person_id
external_object.save
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