# Link\_to\_remote / url path question

**URL:** <https://www.ruby-forum.com/t/link-to-remote-url-path-question/135317>\
**Category:** Rails\
**Created:** [April 21, 2008, 5:40am UTC](https://www.ruby-forum.com/t/link-to-remote-url-path-question/135317 "2008-04-21T05:40:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eboss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ea666f/32.png) [@eboss](https://www.ruby-forum.com/u/eboss)\
**Post date:** [April 21, 2008, 5:40am UTC](https://www.ruby-forum.com/t/link-to-remote-url-path-question/135317/1 "2008-04-21T05:40:11Z")

</div>

I have this helper / link\_to\_remote link I am trying to switch from  
destroy/delete to a separate method/action. Here is the original code.

link\_to\_remote image\_tag(‘delete.png’, :class =\>  
‘png’, :width=\>‘12’, :height=\>‘12’), :url =\> profile\_message\_path(@p,  
message), :method =\> :delete

Current path that produces looks like this

/profiles/1-username/messages/4

I need it to become

/profiles/1-username/messages/remove/4

I don’t think I am understanding the api docs for this such as  
profile\_message\_path to be able to figure out how to add another  
method/action to that URL string. What should my code look like to get  
that?

---

<div class="post-metadata">

**Author:** ![eboss](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ea666f/32.png) [@eboss](https://www.ruby-forum.com/u/eboss)\
**Post date:** [April 21, 2008, 10:12am UTC](https://www.ruby-forum.com/t/link-to-remote-url-path-question/135317/2 "2008-04-21T10:12:57Z")

</div>

That’s a routing issue; take a look at ActionController::Resources,  
specifically the :collection parameter; through it you can introduce  
additional resource methods to your routing. E.g.

map.resources :profiles do |profile|  
profile.resources :messages, :collection =\> { :remove =\> :delete }  
end

would give you

/profiles/1-username/messages/4/remove

- close enough?

Jan
