# Different links after refresh

**URL:** <https://www.ruby-forum.com/t/different-links-after-refresh/166631>\
**Category:** Rails\
**Created:** [April 28, 2009, 1:07am UTC](https://www.ruby-forum.com/t/different-links-after-refresh/166631 "2009-04-28T01:07:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ciscor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@ciscor](https://www.ruby-forum.com/u/ciscor)\
**Post date:** [April 28, 2009, 1:07am UTC](https://www.ruby-forum.com/t/different-links-after-refresh/166631/1 "2009-04-28T01:07:18Z")

</div>

I have a couple of links that appear via Ajax.

\<%= link\_to 'Edit', url\_for(:controller =\> :links, :action =\> "edit", :id =\> link.id) %\> | \<%= link\_to 'Destroy', url\_for(:controller =\> :links, :action =\> "destroy", :id =\> link.id) %\>

After their appearance, they go to  
[http://localhost:3000/users/1/links/110/edit](http://localhost:3000/users/1/links/110/edit) and  
[http://localhost:3000/users/1/links/110](http://localhost:3000/users/1/links/110).

If I refresh the page, they go to [http://localhost:3000/links/edit/110](http://localhost:3000/links/edit/110)  
and [http://localhost:3000/links/destroy/110](http://localhost:3000/links/destroy/110).

Can somebody let me know what causes this, and if there is a better way  
to create these links than to use url\_for.

Thanks!
