Skip to content

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.

2 participants