首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Rails (红矿山)添加路由

Rails (红矿山)添加路由
EN

Stack Overflow用户
提问于 2022-08-06 15:11:45
回答 1查看 29关注 0票数 0

请帮助我以格式添加自定义路由:

代码语言:javascript
运行
复制
/projects/any-project-name/estimated_time/report

控制器:估计时间

方法:报告

routes.rb

代码语言:javascript
运行
复制
Rails.application.routes.draw do
  root :to => 'welcome#index', :as => 'home'
.....
  get '/projects/:project_id/issues/gantt', :to => 'gantts#show', :as => 'project_gantt'
  get '/issues/gantt', :to => 'gantts#show'

.....
resources :time_entries, :controller => 'timelog', :except => [:show, :edit, :update, :destroy] do
      get 'report', :on => :collection
    end
.....
 resources :time_entries, :controller => 'timelog', :only => [:new, :create]
.....
end
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-08-06 15:26:06

试试这个:get 'projects/:project_name_attribute/estimated_time/report' => 'estimatedtimes#report'

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73260931

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档