There’s a post in the linked topic with an example:
Permalink.create(url: '/discussion/12345', topic_id: 987)