sunnyrjuneja
sunnyrjuneja

Reputation: 6123

users_path(user) returns /users.id instead of /users/id when using devise

I find that when I use users_path(user) it returns /users.id where id is the id of the user but I want it to return /users/id. My config routes.rb looks like the following.

# config/routes.rb
Test::Application.routes.draw do
  root to: "static_pages#home"
  resources :users, only: [:index, :show]

  devise_for :users
end

Upvotes: 2

Views: 415

Answers (1)

yfeldblum
yfeldblum

Reputation: 65435

Use this for a path to a singular user:

user_path(user)

Use this for a path to all the users, or the index page:

users_path # no arguments

Upvotes: 2

Related Questions