Sanity check the serialized class.

This commit is contained in:
José Valim
2009-11-15 11:17:40 -02:00
parent 3805bf2f26
commit 4f6dfefe0e
2 changed files with 14 additions and 0 deletions

View File

@@ -93,6 +93,7 @@ module Devise
# Hook to serialize user from session. Overwrite if you want.
def serialize_from_session(keys)
klass, id = keys
raise "#{self} cannot serialize from #{klass} session since it's not its ancestors" unless klass <= self
klass.find_by_id(id)
end
end