Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Change from named_scope to scope #221

Closed
wants to merge 1 commit into from

5 participants

@fedesoria

No description provided.

@capoferro

Dear gem maintainer: Please pull this change in. I see roughly 400 forked repos fixing this problem, so I think people would be very happy to get rid of deprecation messages in their terminals.

@karlfreeman

I'd second what bluepojo said. Much appreciated binarylogic :)

@jjb
jjb commented

hi-- i'm going to try to maintain the One True Rails 3 Fork :) please send your pull request to https://github.com/jjb/authlogic

@eric eric commented on the diff
lib/authlogic/acts_as_authentic/logged_in_status.rb
@@ -32,8 +32,8 @@ module Authlogic
klass.class_eval do
include InstanceMethods
- 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]} }
+ scope :logged_in, lambda { {:conditions => ["last_request_at > ?", logged_in_timeout.seconds.ago]} }
@eric
eric added a note

Will this break Rails 2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ghost

This has been pulled in from alternate pull request. Thanks.

@ghost ghost closed this
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 4, 2011
  1. @fedesoria
This page is out of date. Refresh to see the latest.
View
4 lib/authlogic/acts_as_authentic/logged_in_status.rb
@@ -32,8 +32,8 @@ def self.included(klass)
klass.class_eval do
include InstanceMethods
- 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]} }
+ scope :logged_in, lambda { {:conditions => ["last_request_at > ?", logged_in_timeout.seconds.ago]} }
@eric
eric added a note

Will this break Rails 2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ scope :logged_out, lambda { {:conditions => ["last_request_at is NULL or last_request_at <= ?", logged_in_timeout.seconds.ago]} }
end
end
View
4 test/acts_as_authentic_test/logged_in_status_test.rb
@@ -12,13 +12,13 @@ def test_logged_in_timeout_config
assert_equal 10.minutes.to_i, User.logged_in_timeout
end
- def test_named_scope_logged_in
+ def test_scope_logged_in
assert_equal 0, User.logged_in.count
User.first.update_attribute(:last_request_at, Time.now)
assert_equal 1, User.logged_in.count
end
- def test_named_scope_logged_out
+ def test_scope_logged_out
assert_equal 2, User.logged_out.count
User.first.update_attribute(:last_request_at, Time.now)
assert_equal 1, User.logged_out.count
Something went wrong with that request. Please try again.