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

Add a deprecation DSL #1558

Closed
wants to merge 1 commit into from
Closed

Add a deprecation DSL #1558

wants to merge 1 commit into from

Conversation

bf4
Copy link
Member

@bf4 bf4 commented Mar 7, 2016

Follows #1543
and 6b4c8df

@bf4
Copy link
Member Author

bf4 commented Mar 7, 2016

cc @groyoh

@bf4 bf4 force-pushed the deperecation_dsl branch from 9151104 to b50195f Compare March 7, 2016 07:07
@@ -3,40 +3,37 @@ class Serializer
# @deprecated Use ActiveModelSerializers::Adapter instead
module Adapter
class << self
extend ActiveModelSerializers::Deprecate

def create(resource, options = {})
Copy link
Member

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?

Copy link
Member Author

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.

@groyoh
Copy link
Member

groyoh commented Mar 7, 2016

Awesome work 💯

@bf4
Copy link
Member Author

bf4 commented Mar 7, 2016

@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.

@groyoh
Copy link
Member

groyoh commented Mar 7, 2016

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 ActiveModel::Serializer to ActiveModelSerializers module.

warn "Calling deprecated #{name} (#{__FILE__}) from #{caller[1..3].join(', ')}. Please use ActiveModelSerializers::Adapter"
end
private :warn_deprecation
deprecate :lookup, 'ActiveModelSerializers::Adapter.'
Copy link
Contributor

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'

@NullVoxPopuli
Copy link
Contributor

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.

@groyoh
Copy link
Member

groyoh commented Mar 7, 2016

@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?

@NullVoxPopuli
Copy link
Contributor

yeah, I mean, remove the deprecations when we hit 0.10, but keep the ability to deprecate with ActiveModelSerializers::Deprecate

@NullVoxPopuli
Copy link
Contributor

Actually, we still need a changelog in here -> then I'm ok with merging.

@groyoh groyoh mentioned this pull request Mar 7, 2016
@NullVoxPopuli
Copy link
Contributor

closed in favor of #1559

@bf4 bf4 deleted the deperecation_dsl branch June 14, 2016 02:38
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.

3 participants