Marat_Galiev
Marat_Galiev

Reputation: 1293

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.

Upvotes: 0

Views: 109

Answers (1)

Simone Carletti
Simone Carletti

Reputation: 176342

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

Upvotes: 1

Related Questions