# Adding permalinks error

**URL:** <https://meta.discourse.org/t/adding-permalinks-error/172009>\
**Category:** General\
**Created:** [December 2, 2020, 5:09pm UTC](https://meta.discourse.org/t/adding-permalinks-error/172009 "2020-12-02T17:09:58Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [December 2, 2020, 6:05pm UTC](https://meta.discourse.org/t/adding-permalinks-error/172009/4 "2020-12-02T18:05:27Z")

</div>

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

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

```

---

_[View the full topic](https://meta.discourse.org/t/adding-permalinks-error/172009)._
