开发者

Rails route problem

开发者 https://www.devze.com 2023-02-12 08:36 出处:网络
class UsersController <开发者_开发技巧; ApplicationController def edit ... end Mu routes.rb match \'/user/:id/profile/edit\', :to => \'users#edit\', :as => \"user_profile_edit\", :via =>
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

精彩评论

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