-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Check whether the current attribute being read is aliased or not before reading #26529
Check whether the current attribute being read is aliased or not before reading #26529
Conversation
63cd388
to
8d1e3cb
Compare
r? @sgrif Sean, should we apply same change to |
8d1e3cb
to
8e1ddd9
Compare
👍 read & write should work the same way |
Thanks, I will update it. |
8e1ddd9
to
638670c
Compare
@matthewd done, please review. |
@@ -29,7 +29,13 @@ def __temp__#{safe_name}=(value) | |||
# specified +value+. Empty strings for Integer and Float columns are | |||
# turned into +nil+. | |||
def write_attribute(attr_name, value) | |||
write_attribute_with_type_cast(attr_name, value, true) | |||
name = if self.class.attribute_alias?(attr_name) |
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.
Is not exactly the same code done in attributes_method/read.rb
?
I think this is fine short term. Longer term I want to push this down to AtrributeSet |
@sgrif Sure, I can work on it now as well, should I move it to I see we have |
@prathamesh-sonpatki Can you rebase? This is fine for now to fix the bug regardless of future refactoring. |
…re reading - If aliased, then use the aliased attribute name. - Fixes rails#26417.
638670c
to
7b72fdf
Compare
…ore writing - If aliased, then use the aliased attribute name.
7b72fdf
to
44dc4f6
Compare
@sgrif done, I had started working on pushing the Right now lot of tests also fail so this is just my playing around the code :) But I tried to push the |
Using |
Summary