Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Deprecation notices #215

Closed
wants to merge 2 commits into from

10 participants

@exceed

Hey,

I am long time authlogic fan (even after devise), thanks for making it :-)

Since Rails 3 came along, I found authlogic to be little flaky. Now that I have some time, I am trying to figure things out... In this small trivial fix, I've eliminated some deprecation notices related to Rails 3 for named_scope.

It will be great if you could tell me future plans/todos. I for one need the flexibility, and devise needs competition :D

Cheers,

Amol Hatwar
Exceed Consulting

@kodart

+1

@chebyte

+1

@osaris

+1

@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/session_maintenance.rb
@@ -70,7 +70,11 @@ module Authlogic
# Save the record and skip session maintenance all together.
def save_without_session_maintenance(*args)
self.skip_session_maintenance = true
- result = save(*args)
+ if ('3.0.0' <= Rails::VERSION::STRING)
@eric
eric added a note

It may make more sense to actually check for ActiveRecord::VERSION::MAJOR >= 3 as it's the ActiveRecord version that we care about here.

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 Dec 2, 2010
  1. fixed named_scope deprecation notices for Rails 3+

    Amol HATWAR authored
Commits on Dec 12, 2010
  1. Fixed session save deprecation warnings...

    Amol HATWAR authored
This page is out of date. Refresh to see the latest.
View
9 lib/authlogic/acts_as_authentic/logged_in_status.rb
@@ -32,8 +32,13 @@ 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]} }
+ if Rails::VERSION::STRING > '3.0.0'
+ scope :logged_in, lambda { {:conditions => ["last_request_at > ?", logged_in_timeout.seconds.ago]} }
+ scope :logged_out, lambda { {:conditions => ["last_request_at is NULL or last_request_at <= ?", logged_in_timeout.seconds.ago]} }
+ else
+ 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]} }
+ end
end
end
View
6 lib/authlogic/acts_as_authentic/session_maintenance.rb
@@ -70,7 +70,11 @@ def self.included(klass)
# Save the record and skip session maintenance all together.
def save_without_session_maintenance(*args)
self.skip_session_maintenance = true
- result = save(*args)
+ if ('3.0.0' <= Rails::VERSION::STRING)
@eric
eric added a note

It may make more sense to actually check for ActiveRecord::VERSION::MAJOR >= 3 as it's the ActiveRecord version that we care about here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ result = save(:validate => false) unless args[0]
+ else
+ result = save(*args)
+ end
self.skip_session_maintenance = false
result
end
Something went wrong with that request. Please try again.