Linkt_to problems

I can’t explain where those differences come from.

In one Project I can use the link_to without any problems.
Like this:
<%= link_to “LINKNAME”, :action => “destroy”, :id => ID %>

But in another project… That happens

<%= link_to “delete”, :action => “destroy”, :id => ticket.id %>
<%= link_to “edit”, :action => “edit”, :id => ticket.id %>

and that creates a link to -> http://localhost:3000/tickets/2
-> http://localhost:3000/tickets/2/edit

What i want is -> http://localhost:3000/tickets/destroy/2
-> http://localhost:3000/tickets/edit/2

Slight but important difference.

Can somebody tell me, where I have to configure this?

Thanks a lot!!!

use the :method=> qualifier.

Mukund wrote:

use the :method=> qualifier.

I tried that, but it gives me this:
http://localhost:3000/tickets/index/2?method=edit

Did I do something wrong?

Ma Ka wrote:

Mukund wrote:

use the :method=> qualifier.

I tried that, but it gives me this:
http://localhost:3000/tickets/index/2?method=edit

Did I do something wrong?

Dont be worry about that, it is natural link process if you not describe
link rule in config/routes.rb, like :

map.destroy_tiket ‘:controller/destroy/:id’, :controller => ‘tickets’,
:action => ‘destroy’

I hope my suggestion can help you. good luck.

reinhart
http://teapoci.blogspot.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs