Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

update for "around_filter is deprecated and will be removed in Rails 5.1" #39

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

nao215
Copy link

@nao215 nao215 commented Dec 31, 2016

I got error like this.

DEPRECATION WARNING: around_filter is deprecated and will be removed in Rails 5.1. Use around_action instead.

So, I think around_action is better.
If you have time, review please. 🍣

And happy new year!! ㊗️

@nao215
Copy link
Author

nao215 commented Dec 31, 2016

Hmm..
I don't know why I got lint error in unchanged file, but can I fix lint error??

https://travis-ci.org/airbnb/hypernova/jobs/187915536

@nao215 nao215 changed the title around_filter will be deprecated in rails 5.1 update for "around_filter is deprecated and will be removed in Rails 5.1" Dec 31, 2016
@ljharb
Copy link
Collaborator

ljharb commented Dec 31, 2016

We support down to rails 3.0. Does around_action exist there? If not. We'd have to support both.

@nao215
Copy link
Author

nao215 commented Dec 31, 2016

Okay, only version which >= 4.0.2 can use around_action.
http://apidock.com/rails/v4.0.2/AbstractController/Callbacks/ClassMethods/around_action

I updated README.

@ljharb
Copy link
Collaborator

ljharb commented Dec 31, 2016

Why is around_filter deprecated? How does it differ from around_action? There's no guarantee hypernova is compatible with the latter.

@nao215
Copy link
Author

nao215 commented Dec 31, 2016

Why is around_filter deprecated?

The answer is

Rename all action callbacks from *_filter to *_action to avoid the misconception that these callbacks are only suited for transforming or halting the response. With the new style, it's more inviting to use them as they were intended, like setting shared ivars for views.

Looks like its just change name...
But we cannot use around_filter with new versions. So I think we should change description about it.
If new people read readme, they would be confused by around_filter because it doesnt work.

FYR:
https://github.com/rails/rails/blob/92703a9ea5d8b96f30e0b706b801c9185ef14f0e/guides/source/4_2_release_notes.md#notable-changes-1
rails/rails@9d62e04
rails/rails@6c5f43b

@csharplus
Copy link

@duoertai could you please create a new PR for this change, as the branch for the old PR could not pass CI builds.

@ljharb
Copy link
Collaborator

ljharb commented May 8, 2022

Please do NOT create a new PR; this one should be repurposed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants