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

Support for alias_attributes #728

Closed
OskarEichler opened this issue Mar 22, 2021 · 3 comments
Closed

Support for alias_attributes #728

OskarEichler opened this issue Mar 22, 2021 · 3 comments

Comments

@OskarEichler
Copy link

Hey Zach,

First of all - amazing job with this gem! Our database has much fever anxiety attacks thanks to your work!

Secondly: When trying to perform a .import on a model with an alias_attribute, unfortunately we're getting an error message that the column does not exist.

Would it be possible to add support for that? Thanks so much!

All the best,
Oskar

P.S. Example:

Model - YoutubeArtistRecord
Column - :source_artist_id
alias_attribute - :source_entity_id, :source_artist_id

When performing import with :source_artist_id everything works, but when using :source_entity_id we get an error.

@OskarEichler
Copy link
Author

I think the implementation for this would be pretty quick, by doing the following:

alias_attributes = self.attribute_aliases.symbolize_keys.transform_values!(&:to_sym)
columns.map { |column| alias_attributes[column] || column}

@jkowens
Copy link
Collaborator

jkowens commented Jun 30, 2022

Hey @OskarEichler, sorry I just haven't had time to work on this project lately. If you can provide a PR that would be fantastic 👍

@jkowens
Copy link
Collaborator

jkowens commented May 10, 2023

Resolved by #799

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

No branches or pull requests

2 participants