# Deprecation warning in Rails 3 about Base.named\_scope

**URL:** <https://www.ruby-forum.com/t/deprecation-warning-in-rails-3-about-base-named-scope/194254>\
**Category:** Rails\
**Created:** [September 1, 2010, 6:04pm UTC](https://www.ruby-forum.com/t/deprecation-warning-in-rails-3-about-base-named-scope/194254 "2010-09-01T18:04:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![daze](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/96bed5/32.png) [@daze](https://www.ruby-forum.com/u/daze)\
**Post date:** [September 1, 2010, 6:04pm UTC](https://www.ruby-forum.com/t/deprecation-warning-in-rails-3-about-base-named-scope/194254/1 "2010-09-01T18:04:20Z")

</div>

I recently upgraded to Rails 3, and this error has come up  
ubiquitously:

DEPRECATION WARNING: Base.named\_scope has been deprecated, please use  
Base.scope instead.

Any ideas on how to get rid of it? Or should I just wait for  
something?  
There’s actually no place in my application where the code  
“Base.named\_scope” exists, so I assume the problem is inherent in gems  
that haven’t gotten up to speed with Rails 3 yet.

Someone on stackoverflow also posted this issue:

> <https://stackoverflow.com/questions/3333612/how-to-avoid-deprecation-warning-with-named-scope-rails-2-x-scope-rails-3>

I’d appreciate any help. Thanks in advance =].

---

<div class="post-metadata">

**Author:** ![daze](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/96bed5/32.png) [@daze](https://www.ruby-forum.com/u/daze)\
**Post date:** [September 1, 2010, 6:11pm UTC](https://www.ruby-forum.com/t/deprecation-warning-in-rails-3-about-base-named-scope/194254/2 "2010-09-01T18:11:37Z")

</div>

daze wrote:

> I recently upgraded to Rails 3, and this error has come up  
> ubiquitously:
> 
> DEPRECATION WARNING: Base.named\_scope has been deprecated, please use  
> Base.scope instead.
> 
> Any ideas on how to get rid of it? Or should I just wait for  
> something?  
> There’s actually no place in my application where the code  
> “Base.named\_scope” exists,

That literal string doesn’t have to be present; it’s just the qualified  
name of the method being called. Are you calling named\_scope anywhere?

> so I assume the problem is inherent in gems  
> that haven’t gotten up to speed with Rails 3 yet.
> 
> Someone on stackoverflow also posted this issue:  
> [How to avoid deprecation warning with named\_scope (rails 2.X) / scope (rails 3) class\_method - Stack Overflow](http://stackoverflow.com/questions/3333612/how-to-avoid-deprecation-warning-with-named-scope-rails-2-x-scope-rails-3-c)
> 
> I’d appreciate any help. Thanks in advance =].

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![daze](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/96bed5/32.png) [@daze](https://www.ruby-forum.com/u/daze)\
**Post date:** [September 1, 2010, 6:44pm UTC](https://www.ruby-forum.com/t/deprecation-warning-in-rails-3-about-base-named-scope/194254/3 "2010-09-01T18:44:44Z")

</div>

On Wed, Sep 1, 2010 at 10:22 AM, daze [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I recently upgraded to Rails 3, and this error has come up  
> ubiquitously:
> 
> DEPRECATION WARNING: Base.named\_scope has been deprecated, please use  
> Base.scope instead.
> 
> Any ideas on how to get rid of it? Or should I just wait for  
> something?

ActiveRecord’s named\_scope was changed to scope in Rails 3, and uses the  
new  
ActiveRecord query interface.  
See also:

> **[edgerails.info](http://edgerails.info/articles/what-s-new-in-edge-rails/2010/02/23/the-skinny-on-scopes-formerly-named-scope/)**
>
> This domain may be for sale!

> There’s actually no place in my application where the code  
> “Base.named\_scope” exists, so I assume the problem is inherent in gems  
> that haven’t gotten up to speed with Rails 3 yet.

If you aren’t using any named\_scopes, then it sounds like you might want  
to  
isolate the problem to a specific gem or plugin and log a bug with the  
author. Try creating a new Rails 3 project and adding your gems one by  
one.

> Someone on stackoverflow also posted this issue:
> 
> [How to avoid deprecation warning with named\_scope (rails 2.X) / scope (rails 3) class\_method - Stack Overflow](http://stackoverflow.com/questions/3333612/how-to-avoid-deprecation-warning-with-named-scope-rails-2-x-scope-rails-3-c)
> 
> I’d appreciate any help. Thanks in advance =].

Adam

---

<div class="post-metadata">

**Author:** ![daze](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/96bed5/32.png) [@daze](https://www.ruby-forum.com/u/daze)\
**Post date:** [September 1, 2010, 10:37pm UTC](https://www.ruby-forum.com/t/deprecation-warning-in-rails-3-about-base-named-scope/194254/4 "2010-09-01T22:37:46Z")

</div>

okay, thanks…I think I might try that. (I did not have any  
occurrences of named\_scope anywhere in my code, just for  
clarification)

I noticed though that the problem seems to stem from the  
acts\_as\_authentic line in my User model. might that mean anything?  
what exactly is that line anyway…

---

<div class="post-metadata">

**Author:** ![daze](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/96bed5/32.png) [@daze](https://www.ruby-forum.com/u/daze)\
**Post date:** [September 1, 2010, 11:41pm UTC](https://www.ruby-forum.com/t/deprecation-warning-in-rails-3-about-base-named-scope/194254/5 "2010-09-01T23:41:02Z")

</div>

On Wed, Sep 1, 2010 at 1:37 PM, daze [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I noticed though that the problem seems to stem from the  
> acts\_as\_authentic line in my User model. might that mean anything?  
> what exactly is that line anyway…

Presumably you put it there? 🙂

Anyway, from a project of my own:

$ find -type f -name ‘\*.rb’ -exec grep -H ‘acts\_as\_authentic’ {} ;  
app/models/user.rb: acts\_as\_authentic do |c|  
vendor/gems/authlogic-2.1.6/lib/authlogic/acts\_as\_authentic/base.rb:

# Provides the base functionality for acts\_as\_authentic

$ find vendor/gems/authlogic-2.1.6 -type f -name ‘\*.rb’ -exec grep  
‘named\_scope’ {} ;  
named\_scope :logged\_in, lambda { {:conditions =\>  
[“last\_request\_at \> ?”, logged\_in\_timeout.seconds.ago]} }  
named\_scope :logged\_out, lambda { {:conditions =\>  
[“last\_request\_at is NULL or last\_request\_at \<= ?”,  
logged\_in\_timeout.seconds.ago]} }  
…  
$

## FWIW,

Hassan S. ------------------------ removed\_email\_address@domain.invalid  
twitter: @hassan
