开发者

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) %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜