Sending mail from model using `self` and GlobalID in Rails edge

I wanted to see if the following is reproducible and possible a bug or intended behavior.

I have a Meeting model that has a state machine. When a state is changed, I’d like the callback to send an email through the MeetingMailer in the background through ActiveJob. Passing self in the callback seems to pass the wrong URI for the GlobalID and triggers the URI::InvalidURIError. If I move the call to send the mail to the controller and pass in a meeting object then everything works fine. Maybe I’m not understanding how GlobalID is used but I wanted to know if anyone else has tried this yet.



Did you check that self in the context of your state-machine callback is the actual model instance and not some different object? If it’s a meeting instance like the one in the controller, a sample application would go a long way to help us debug the issue. Would be great to have a minimal Rails application that showcases the issue up on GitHub.


— Yves