Find the reply key for a specific topic. Rails console magic?

To be honest, I wasn’t very familiar with this part of the system, but it seems simple enough. This is where the reply key is created or retrieved for a given post and user, to be used when sending an email: