更改嵌套资源参数

时间:2016-01-29 06:19:33

标签: ruby-on-rails ruby url routes

我正在尝试更改嵌套资源中的参数但由于某种原因它添加了父资源的名称

的routes.rb

  resources :users, path: 're', param: :username do
    resource :profile
  end

这就是我的路线现在的样子

user_profile POST   /re/:user_username/profile(.:format)      profiles#create
    new_user_profile GET    /re/:user_username/profile/new(.:format)  profiles#new
   edit_user_profile GET    /re/:user_username/profile/edit(.:format) profiles#edit
                     GET    /re/:user_username/profile(.:format)      profiles#show
                     PATCH  /re/:user_username/profile(.:format)      profiles#update
                     PUT    /re/:user_username/profile(.:format)      profiles#update
                     DELETE /re/:user_username/profile(.:format)      profiles#destroy
               users GET    /re(.:format)                             users#index
                     POST   /re(.:format)                             users#create
            new_user GET    /re/new(.:format)                         users#new
           edit_user GET    /re/:username/edit(.:format)              users#edit
                user GET    /re/:username(.:format)                   users#show
                     PATCH  /re/:username(.:format)                   users#update
                     PUT    /re/:username(.:format)                   users#update
                     DELETE /re/:username(.:format) 

如何更改/re /:username / profile / new(。:format)的/re/:user_username/profile/new(.:format)

0 个答案:

没有答案