Fout bij het toevoegen van permalinks

You almost certainly want to be creating permalinks from the console, not the web interface, with something like

Permalink.find_or_create_by(url: 'some/path/you/like', topic_id: 123)

That way it won’t matter if you call it multiple times.

Note that if you instead do:

Permalink.find_or_create_by(url: '/some/path/you/like', topic_id: 123)

it will fail on subsequent calls because it’ll strip the leading / before it does the create.

And if you really do want to delete/change paths that you created wrong the first time, you’d do something like

p=Permalink.find_by(url: 'some/path/you/like')
p.destroy if p
3 likes