我正在努力让用户名显示在与设计相关的路线中。
如何让以下路线显示?
www.blabla.com/username/edit
www.blabla.com/username/event/id
我必须在范围内声明一个范围吗?谢谢您的帮助。
现在我的路线文件看起来像这样
Weplanthings::Application.routes.draw do
resources :vendors
resources :venues
resources :events
get "profiles/index"
get "users/index"
get "users/show"
get 'tags/:tag', to: 'events#index', as: :tag
authenticated :user do
root :to => 'home#index'
end
match '/event/new', :to => 'events#new'
root :to => "home#index"
devise_for :users do
get "/login" => "devise/sessions#new"
match '/login', :to => 'devise/sessions#new'
get "/logout" => "devise/sessions#destroy"
match '/logout', :to => 'devise/sessions#destroy'
get "/edit" => "devise/sessions#edit"
match '/edit', :to => 'devise/sessions#edit'
scope ":username", :as => "user" do
#resources :users
match '/', :to => 'profiles#index'
match '/edit', :to => 'devise/sessions#edit'
match '/event/:id', :to => 'events#show'
end
end