2013-11-26 84 views
0

我有以下鏈接軌道4路由與編輯字段

<%= link_to 'Update Profile', controller: :customers, action: :edit, id: session[:customer_id] %> 

將生成的URL

http://localhost:3000/customers/17/edit 

但是,當我修改我的路線爲

get 'edit_customer' => 'customers#edit' 

我的鏈接像這樣

<li><%= link_to 'Update Profile', edit_customer_path(session[:customer]) %></li> 

生成的URL是

http://localhost:3000/customers//edit 

如何糾正這一

回答

0

變化:edit_customer_path(session[:customer])

到:edit_customer_path(session[:customer.id])

+0

我希望會話[:客戶]持有的客戶ID – overflow

+0

@Seting是你的權利 – kndwsu