简体   繁体   中英

How to avoid deprecation warning with named_scope (rails 2.X) / scope (rails 3) class_method

I build several plugins using the class method 'named_scope', which has been deprecated and replaced by 'scope' in Rails 3. I would like to avoid the following warning as I have lot a scopes present in my plugins :

DEPRECATION WARNING: Base.named_scope has been deprecated, please use Base.scope instead.

How to you deal with that? Did you create any 'scope' method if it's rails 2.X and pass the information to 'named_scope'? Any clean suggestion?

Cheers!

Vincent

唯一真正的解决办法是修复输出此错误的实际插件。

只需将named_scope更改为您在何处调用的范围。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM