P
P
Perzh2014-04-11 09:44:05
Ruby on Rails
Perzh, 2014-04-11 09:44:05

Invalid users_path

Hello. The problem is this: users_path(user) returns the string '/users.1' when it should return '/users/1' . Please tell me how can I fix this?
routes.rb:

# USERS
  match '/signup', to: 'users#new', via: 'get'
  match '/users/:id', to: 'users#show', via: 'get'
  match '/users', to: 'users#create', via: 'post'
  match '/users/:id/edit', to: 'users#edit', via: 'get'
  match '/users/:id', to: 'users#update', via: 'patch'
  match '/users/:id', to: 'users#destroy', via: 'delete'

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Kirill Platonov, 2014-04-11
@Perzh

Try with explicit prefix

# routes.rb
get '/users/:id' => 'users#show', as: :users_show

# и вызов
users_show_path(user)

V
Vladimir Gorbunov, 2015-09-07
@Tigronix

That's right, just wrote it in the wrong place. Write it already in an already existing path, before d.
<path style="fill:#65C178;" d=""/>

D
Denis Ineshin, 2015-09-07
@IonDen

So fill needs to be added to the path to which you change the color, and you have some kind of path there, which is nowhere to be seen. Add next.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question