Joseph Le Brech
Joseph Le Brech

Reputation: 6653

link_to with :action

I have an link to the show action but I want it to go to the "edit" action

<%= link_to("Previous Post", @line.previous) if @line.previous %>

how do I change this to go to "edit" rather than "show"?

Upvotes: 0

Views: 89

Answers (1)

Dty
Dty

Reputation: 12273

Something like the following. There are more examples at apidock

link_to "Previous Post", :controller => "profiles", :action => "edit", :id => @profile

# => <a href="/profiles/edit/1">Previous Post</a>

Upvotes: 1

Related Questions