开发者

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

开发者 https://www.devze.com 2023-01-09 01:24 出处:网络
I build several plugins using the class method \'named_scope\', which has been deprecated and replaced by \'scope\' in Rails 3.

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 sugg开发者_如何学JAVAestion?

Cheers!

Vincent


Only real fix for this is to fix actual plugins outputting this error.


Just change named_scope to scope from where are you calling it.

0

精彩评论

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