所以这里有我的路线
concern :search do
scope '/search' do
get '/', to: 'users#search'
get '/schedule/:id', to: 'schedules#user'
end
end
concerns :search
scope '/dashboard' do
concerns :search
end
问题是rails并没有给我路径助手。我怎样才能根据我所称的方式为我的问题设置不同的路径。我想要这样的东西
search_path
search_schedule_path
dashboard_search_path
dashboard_search_schedule_path
答案 0 :(得分:1)
最后我认为它
concern :search do
scope '/search', as: :search do
get '/', to: 'users#search'
get '/schedule/:id', to: 'schedules#user', as: :schedule
end
end
concerns :search
scope '/dashboard', as: :dashboard do
concerns :search
end
这是我的路径助手
search_path
search_schedule_path
dashboard_search_path
dashboard_search_schedule_path