Take the 2-minute tour ×

I want to make a back link that will link to the controller index.

<%= link_to 'Back', employee_personals_path%> 

It works. But in index i want to send user id also.

 <%= link_to 'Back', {  :action => "index", :user_id => @user_id},
   {:class=>"btn btn-success"}%>

This works. Now i want to implement sending user_id by first method

<%= link_to 'Back', employee_personals_path, :user_id => @user_id%> 

But it does not works. How can i make it work?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

You need to pass a parameter to your employee_personals_path function (not to link_to):

<%= link_to 'Back', employee_personals_path(:user_id => @user_id) %>
share|improve this answer
this will work if you are using restful paths in your routes –  sanny Sin Dec 24 '12 at 13:06
I have like this issue in my update controller stackoverflow.com/questions/14037524/… I hope you can answer it] –  regmiprem Dec 26 '12 at 8:17
add comment

Your Answer


