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

Import breaks when two column backed attributes are aliased together #817

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

skunkworker
Copy link

When a record has two column backed attributes that are aliased together, import breaks across the board because both column names are provided. I briefly looked to see if this was a code smell in ActiveRecord but have not been able to find anything definitive either way.

Take the following:

create_table :topics, force: :cascade do |t|
  t.string :author_name
  t.string :author_full_name
end

class Topic < ActiveRecord::Base
  alias_attribute :author_full_name, :author_name
end

When the record is trying to be imported. author_name will be specified twice in the import string.

@jkowens
Copy link
Collaborator

jkowens commented Sep 7, 2023

Aha! Ok, thank you for getting to the root issue.

@jkowens
Copy link
Collaborator

jkowens commented Sep 12, 2023

@leonidkroka here is a some more info about a failing scenario with alias_attribute. Any ideas how to make sure column names in the generated sql are unique in this scenario?

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

Successfully merging this pull request may close these issues.

None yet

2 participants