开发者

Before_filter for rails 3?

开发者 https://www.devze.com 2023-03-31 17:36 出处:网络
According to what I\'m reading in the docs, the before_filter method is deprecated. This question is two-fold: First, is that correct (It doesn\'t work in Rails 3, so I\'m pretty sure it is) and seco

According to what I'm reading in the docs, the before_filter method is deprecated.

This question is two-fold: First, is that correct (It doesn't work in Rails 3, so I'm pretty sure it is) and second, what is another way to replicate that method just with using Rails/Ruby's built-in methods?

From what I can find, there isn't anyt开发者_StackOverflow社区hing like it, but I could be looking in the wrong place.


Rails 4.2's changelogs mention that all *_filter methods are going away in favor of their *_action counterparts.

Versions up to Rails 4.2 can use before_filter as they please. Versions 4.2 and above should use before_action (and friends) instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消