-
Notifications
You must be signed in to change notification settings - Fork 9
Accept import capitalisation differences #3361
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
Accept import capitalisation differences #3361
Conversation
525d89a
to
620165f
Compare
69cf6a4
to
d5a8c60
Compare
d5a8c60
to
c3c8688
Compare
443997c
to
b6979e3
Compare
fb56247
to
b6f8b99
Compare
8ce9388
to
2719233
Compare
70bd51f
to
3f6e39d
Compare
2719233
to
07d4db9
Compare
1045f5f
to
d1cf05b
Compare
c5cbc83
to
aa5838b
Compare
|
||
included { attribute :pending_changes, :jsonb, default: {} } | ||
|
||
def stage_changes(attributes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's potential to refactor this method as I'm finding it a bit complicated/hard to read. I've got a suggestion below which I think works and I find easier to understand:
def stage_changes(attributes)
attributes.each do |attr, new_value|
current_value = public_send(attr)
if normalised(new_value) == normalised(current_value)
public_send("#{attr}=", new_value)
pending_changes.delete(attr.to_s)
else
pending_changes[attr.to_s] = new_value
end
end
save!
end
private
def normalised(value)
value.respond_to?(:downcase) ? value.downcase : value
end
What do you think?
aa5838b
to
a9148b3
Compare
|
Hmm it seems like merging |
New PR for this change: #3588 |
Implement some extra logic when importing, which:
MAV-926