Rails route problem
class UsersController <开发者_开发技巧; ApplicationController
def edit
...
end
Mu routes.rb
match '/user/:id/profile/edit', :to => 'users#edit', :as => "user_profile_edit", :via => "get"
My link:
<%= link_to image_tag("icons/run.png"), user_profile_edit_path %>
Exception:
No route matches {:controller=>"users", :action=>"edit"}
What I'm doing wrong? Thanks.
You need to supply the user record.
Assuming the record is assigned to @user
<%= link_to image_tag("icons/run.png"), user_profile_edit_path(@user) %>
精彩评论