-
Notifications
You must be signed in to change notification settings - Fork 141
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
Expose attribute aliases in list of attributes #1278
Conversation
38d375b
to
489e623
Compare
@@ -21,7 +21,7 @@ def attribute_selection | |||
if !@req.attributes.empty? || @additional_attributes | |||
@req.attributes | Array(@additional_attributes) | ID_ATTRS | |||
else | |||
Picture.attribute_names - %w(content) | |||
Picture.attribute_names | Picture.try(:attribute_aliases)&.keys - %w(content) |
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 made a comment in the other PR, but I don't understand this. Does this not return the same thing in Rails 7.1 as in 7.0? In 7.0 the |
WIP: introducing more generic method for the concept of attributes and attribute aliases. After that is done, will change this code to leverage that. |
489e623
to
8383a3d
Compare
update:
un-WIP |
8383a3d
to
f2d7ff9
Compare
f2d7ff9
to
a92ad3d
Compare
This assertion on the response body fails against master code before this branch. I think the intention was to test that creation with a virtual columns works.
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.
LGTM
Fixes deprecation of this variety: Foo model aliases `x`, but `x` is not an attribute. Starting in Rails 7.2, alias_attribute with non-attribute targets will raise. Use `alias_method :y, :x` or define the method manually. This also handles aliases on association methods We use runtime method delegation instead of class load time alias_method. In Rails 7.1, the attribute/association methods aren't defined at class load time so we can't alias them. Note, we can remove virtual_column/attribute on actual attributes with alias_attribute due to: ManageIQ#23324 ManageIQ/manageiq-automation_engine#565 ManageIQ/manageiq-api#1278 ManageIQ#23321
Fixes deprecation of this variety: Foo model aliases `x`, but `x` is not an attribute. Starting in Rails 7.2, alias_attribute with non-attribute targets will raise. Use `alias_method :y, :x` or define the method manually. This also handles aliases on association methods We use runtime method delegation instead of class load time alias_method. In Rails 7.1, the attribute/association methods aren't defined at class load time so we can't alias them. Note, we can remove virtual_column/attribute on actual attributes with alias_attribute due to: ManageIQ#23324 ManageIQ/manageiq-automation_engine#565 ManageIQ/manageiq-api#1278 ManageIQ#23321
Blocked:
This enables fixes for 7.1
But this does not depend upon 7.1 and even in 7.0 is a more accurate implementation