undefined method `user_path'

后端 未结 2 1427
星月不相逢
星月不相逢 2021-02-01 03:44

I am trying to construct a users model manually (without using \'resources :users\' in the routes.rb file). My routes.rb file looks like this:

match \'/users/:id         


        
2条回答
  •  面向向阳花
    2021-02-01 04:45

    For everyone who using rails 4 in your routes.rb post '/users', :to => 'users#create', :as => :user and you controller render json: @user, status: :created, location: @user_path

提交回复
热议问题