generate token method should reference base class to avoid STI child class mismatch
haroldus- opened this issue · 1 comments
haroldus- commented
I think that the base_class
should be referenced when generating the token since this is what is saved in the subscriber_type
column:
module Mailkick
...
def self.generate_token(subscriber, list)
raise ArgumentError, "Missing subscriber" unless subscriber
raise ArgumentError, "Missing list" unless list.present?
message_verifier.generate([nil, subscriber.id, subscriber.class.base_class.name, list])
end
...
end
otherwise the child class name is referenced and the subscriber, being of a child class type, can't unsubscribe.
ankane commented
Hi @haroldus-, thanks for reporting! Fixed in the commit above.