module ActiveRecord::SignedId::ClassMethods
def find_signed!(signed_id, purpose: nil)
User.first.destroy
signed_id = User.first.signed_id
User.find_signed! "bad data" # => ActiveSupport::MessageVerifier::InvalidSignature
=== Examples
the valid signed id can't find a record.
or has been tampered with. It will also raise an +ActiveRecord::RecordNotFound+ exception if
exception if the +signed_id+ has either expired, has a purpose mismatch, is for another record,
Works like find_signed, but will raise an +ActiveSupport::MessageVerifier::InvalidSignature+
def find_signed!(signed_id, purpose: nil) if id = signed_id_verifier.verify(signed_id, purpose: combine_signed_id_purposes(purpose)) find(id) end end