Permalink
Browse files

Do not rely on attribute? methods since they are not available in Dat…

…amapper.
  • Loading branch information...
1 parent 2f759f8 commit 3efc0ec08a567973c84ed9a9de165774eadb9269 @josevalim josevalim committed Nov 22, 2009
Showing with 10 additions and 5 deletions.
  1. +3 −0 CHANGELOG.rdoc
  2. +2 −0 TODO
  3. +3 −3 lib/devise/models/confirmable.rb
  4. +2 −2 lib/devise/models/rememberable.rb
View
3 CHANGELOG.rdoc
@@ -1,3 +1,6 @@
+* enhancements
+ * [#45] Do not rely attribute? methods, since they are not added on Datamapper
+
== 0.5.6
* enhancements
View
2 TODO
@@ -1,3 +1,5 @@
+* Create update_with_password
+* Make test run with different ORMs
* Devise::Timeoutable
* Use request_ip in session cookies
* Devise::BruteForceProtection
View
6 lib/devise/models/confirmable.rb
@@ -51,7 +51,7 @@ def confirm!
# Verifies whether a user is confirmed or not
def confirmed?
- !new_record? && confirmed_at?
+ !new_record? && !confirmed_at.nil?
end
# Send confirmation instructions by email
@@ -100,8 +100,8 @@ def active?
# confirmation_period_valid? # will always return false
#
def confirmation_period_valid?
- confirmation_sent_at? &&
- (Time.now.utc - confirmation_sent_at.utc) < confirm_within
+ confirmation_sent_at &&
+ ((Time.now.utc - confirmation_sent_at.utc) < confirm_within)
end
# Checks whether the record is confirmed or not, yielding to the block
View
4 lib/devise/models/rememberable.rb
@@ -51,7 +51,7 @@ def remember_me!
# Removes the remember token only if it exists, and save the record
# without validations.
def forget_me!
- if remember_token?
+ if remember_token
self.remember_token = nil
self.remember_created_at = nil
save(false)
@@ -60,7 +60,7 @@ def forget_me!
# Checks whether the incoming token matches or not with the record token.
def valid_remember_token?(token)
- remember_token? && !remember_expired? && remember_token == token
+ remember_token && !remember_expired? && remember_token == token
end
# Remember token should be expired if expiration time not overpass now.

0 comments on commit 3efc0ec

Please sign in to comment.