Skip to content

Commit

Permalink
add persisted? for rails 3, thanks to nzadrozny
Browse files Browse the repository at this point in the history
  • Loading branch information
binarylogic committed Sep 5, 2010
1 parent 5661867 commit 66ed795
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/authlogic/session/foundation.rb
Expand Up @@ -53,6 +53,10 @@ def inspect
"#<#{self.class.name}: #{credentials.blank? ? "no credentials provided" : credentials.inspect}>"
end

def persisted?
!(new_record? || destroyed?)
end

def to_key
new_record? ? nil : [ self.send(self.class.primary_key) ]
end
Expand Down

2 comments on commit 66ed795

@nz
Copy link

@nz nz commented on 66ed795 Sep 10, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, I totally forgot about that ;)

@ajkovar
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attempting to apply this gives me "undefined method `destroyed?' for #<UserSession: {:unauthorized_record=>""}>" ??

Please sign in to comment.