Ruby Padrino:在将另一个项目装入主项目后,找不到已装入的路由器
发行说明: 有两个项目,一个是主项目,另一个是时间表应用程序。 我想把TimeSheet\u应用程序安装到主项目中 当访问url时http://localhost:3000/tsheet/base它说 西纳特拉不知道这首小调Ruby Padrino:在将另一个项目装入主项目后,找不到已装入的路由器,ruby,rack,mount,padrino,Ruby,Rack,Mount,Padrino,发行说明: 有两个项目,一个是主项目,另一个是时间表应用程序。 我想把TimeSheet\u应用程序安装到主项目中 当访问url时http://localhost:3000/tsheet/base它说 西纳特拉不知道这首小调 Try this: # in app.rb class Qiankun::App get '/tsheet/base' do "Hello World" end end 这里是控制台输出 DEBUG - 20/Aug/2014 14:15:22
Try this:
# in app.rb
class Qiankun::App
get '/tsheet/base' do
"Hello World"
end
end
这里是控制台输出
DEBUG - 20/Aug/2014 14:15:22 GET (0.0870s) /tsheet/base - 404 Not Found
DEVEL - 20/Aug/2014 14:15:22 Reloading application TimesheetApp::App
DEVEL - 20/Aug/2014 14:15:22 Reloading application TimesheetApp::App
DEVEL - 20/Aug/2014 14:15:22 Reloading application TimesheetApp::Tsheet
DEVEL - 20/Aug/2014 14:15:22 Reloading application TimesheetApp::Tsheet
DEBUG - 20/Aug/2014 14:15:22 GET (0.1120s) /tsheet/__sinatra__/404.png -
04 Not Modified
在时间表_应用程序self中,运行padrino启动后,访问http://localhost:3000/base 没关系
在主项目中,检查rake路由,找到另一个项目的url tsheet/base就在那里
(:base, :index) GET /tsheet/base
下面是一些与mount相关的代码
在主项目apps.rb中
在主项目文件中
下面是控制器代码,非常简单
有什么想法吗?也许是padrino框架中的错误
帕德里诺版本0.12.3我认为带有.to'/time\u sheet'的挂载让我和你甚至帕德里诺都感到困惑
应提供以下地址:http://localhost:3000/time_sheet/tsheet/base 和
http://localhost:3000/tsheet/ 索引
这些应用程序不知道安装到何处,因此,如果以后将此应用程序包含在其他地方,则可以更轻松地定义本地应用程序和控制器,而无需进行更改
让这件事比必要的更难理解的是,您定义了get'/tsheet/base,然后将它挂载为tsheet,这也使得谈论起来更加困难。如果你的问题不是答案,请先考虑改名,让你的例子更容易理解和讨论。 < P>快速修复:请设置SET:重新加载,假到你的GMP应用程序。
Padrino.mount('TimesheetApp::App', :app_file => TimesheetApp.root('app/app.rb')).to('/time_sheet')
Padrino.mount('TimesheetApp::Tsheet', :app_file => TimesheetApp.root('tsheet/app.rb')).to("/tsheet")
gem 'timesheet_app',:path=>"d:\\IdeaLab\\timesheet_app",:require=>"timesheet_app"
TimesheetApp::Tsheet.controllers :base do
enable :reload
get :index do
"hello , tsheet!"
end
end