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

Provide a way decorate_attribute for attribute type decoration #41262

Closed
wants to merge 1 commit into from

Conversation

kamipo
Copy link
Member

@kamipo kamipo commented Jan 28, 2021

Just an implementation for #41139 (comment).

cc @kaspth

Copy link
Contributor

@kaspth kaspth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Are there any other ramifications we'd need to be aware of with this? If not, then we're just missing a CHANGELOG entry.

@kamipo
Copy link
Member Author

kamipo commented Jan 28, 2021

I'd say no, it is just a wrapper for attribute(:attr_name) { |subtype| Type.lookup(:type_name, subtype: subtype) }.

I'll add a CHANGELOG entry later before merging this.

@kaspth
Copy link
Contributor

kaspth commented Jan 29, 2021

Cool, let's go for it 👍

@rafaelfranca
Copy link
Member

I think we should have a decorate_attrubute but I don't think attribute behavior should be a decoration. It should be a override without knowledge of the type in the superclass.

@kamipo
Copy link
Member Author

kamipo commented Feb 9, 2021

I don't intend to expose the internal attribute behavior that enum and serialize depend on in the doc, like #28640 (comment) (e8cb53b).

If we prefer to entirely avoid the internal behavior in attribute, I would try that.

@rails-bot
Copy link

rails-bot bot commented May 10, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Thank you for your contributions.

@rails-bot rails-bot bot added the stale label May 10, 2021
@zzak zzak removed the stale label May 10, 2021
@zzak
Copy link
Member

zzak commented May 10, 2021

Go away @rails-bot /cc @kamipo

@rails-bot
Copy link

rails-bot bot commented Aug 8, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Thank you for your contributions.

@rails-bot rails-bot bot added the stale label Aug 8, 2021
@rails-bot rails-bot bot closed this Aug 15, 2021
@kamipo kamipo reopened this Aug 15, 2021
@rails-bot rails-bot bot removed the stale label Aug 15, 2021
@rails-bot
Copy link

rails-bot bot commented Nov 13, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Thank you for your contributions.

@rails-bot rails-bot bot added the stale label Nov 13, 2021
@kamipo kamipo removed the stale label Nov 15, 2021
@rails-bot
Copy link

rails-bot bot commented Feb 13, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Thank you for your contributions.

@rails-bot rails-bot bot added the stale label Feb 13, 2022
@rails-bot rails-bot bot closed this Feb 20, 2022
@kamipo kamipo reopened this Feb 26, 2022
@rails-bot rails-bot bot removed the stale label Feb 26, 2022
jonathanhefner added a commit to jonathanhefner/rails that referenced this pull request Mar 12, 2022
This adds support for decorating Active Model attribute types, similar
to Active Record, but with the `decorate_attribute` API from rails#41262.
For now, this is kept as a private API.

Co-authored-by: Ryuta Kamizono <kamipo@gmail.com>
jonathanhefner added a commit to jonathanhefner/rails that referenced this pull request Mar 12, 2022
This adds support for decorating Active Model attribute types, similar
to Active Record, but with the `decorate_attribute` API from rails#41262.
For now, this is kept as a private API.

Co-authored-by: Ryuta Kamizono <kamipo@gmail.com>
jonathanhefner added a commit to jonathanhefner/rails that referenced this pull request Mar 18, 2022
This adds support for decorating Active Model attribute types, similar
to Active Record, but with the `decorate_attribute` API from rails#41262.
For now, this is kept as a private API.

Co-authored-by: Ryuta Kamizono <kamipo@gmail.com>
@kamipo
Copy link
Member Author

kamipo commented Apr 19, 2024

Closing in favor of #44665.

@kamipo kamipo closed this Apr 19, 2024
@kamipo kamipo deleted the decorate_attribute branch April 19, 2024 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants