Deprecation warning in Rails 3 about Base.named_scope

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:

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

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

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

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

On Wed, Sep 1, 2010 at 10:22 AM, daze [email protected] 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:

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

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

Adam

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…

On Wed, Sep 1, 2010 at 1:37 PM, daze [email protected] 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? :slight_smile:

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. ------------------------ [email protected]
twitter: @hassan