-
Notifications
You must be signed in to change notification settings - Fork 1.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
Add a deprecation DSL #1558
Add a deprecation DSL #1558
Conversation
cc @groyoh |
@@ -3,40 +3,37 @@ class Serializer | |||
# @deprecated Use ActiveModelSerializers::Adapter instead | |||
module Adapter | |||
class << self | |||
extend ActiveModelSerializers::Deprecate | |||
|
|||
def create(resource, options = {}) |
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.
Would delegate :create, to: ActiveModelSerializers::Adapter
work here?
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.
y'know, I tried it with ruby's delegate and forwardable, but not with rails' delegate. Feel free to try. I think you can push to my branch.
Awesome work 💯 |
@groyoh to be honest, I'm not sure if I like this as a 'another thing in AMS. OTOH, it does take most of the drudgery out of deprecating. OTOH (three hands), we can remove it when we hit 0.10.0. |
I also think that it would be better to get rid of it once we hit 0.10.0. But right now, it definitely makes things cleaner and easier to handle, especially once we move |
warn "Calling deprecated #{name} (#{__FILE__}) from #{caller[1..3].join(', ')}. Please use ActiveModelSerializers::Adapter" | ||
end | ||
private :warn_deprecation | ||
deprecate :lookup, 'ActiveModelSerializers::Adapter.' |
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 really like this implementation, good thinkin'
I actually think we should keep the deprecation module when we hit 0.10. That way when can use the same code if nothing better comes around by the time we need to start deprecating stuff again. Unless there are any more TODOs, I'm good with merging this. |
@NullVoxPopuli Wouldn't deprecation lead to a breaking change at that point? Would these deprecated elements then be removed at some point? In 0.11? |
yeah, I mean, remove the deprecations when we hit 0.10, but keep the ability to deprecate with |
Actually, we still need a changelog in here -> then I'm ok with merging. |
closed in favor of #1559 |
Follows #1543
and 6b4c8df