hypernova icon indicating copy to clipboard operation
hypernova copied to clipboard

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

Open nao215 opened this issue 9 years ago • 7 comments

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 avatar Dec 31 '16 16:12 nao215

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 avatar Dec 31 '16 16:12 nao215

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

ljharb avatar Dec 31 '16 18:12 ljharb

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.

nao215 avatar Dec 31 '16 20:12 nao215

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

ljharb avatar Dec 31 '16 20:12 ljharb

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 https://github.com/rails/rails/commit/9d62e04838f01f5589fa50b0baa480d60c815e2c https://github.com/rails/rails/commit/6c5f43bab8206747a8591435b2aa0ff7051ad3de

nao215 avatar Dec 31 '16 21:12 nao215

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

csharplus avatar May 08 '22 01:05 csharplus

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

ljharb avatar May 08 '22 02:05 ljharb