相关疑难解决方法(0)

为可安装的Rails 3.1引擎列出'rake routes'

我正在开发一个可安装的引擎,用于Rails 3.1,我想列出引擎的路由.

我用以下方法创建了引擎:

$ rails plugin new rails_blog_engine --mountable
Run Code Online (Sandbox Code Playgroud)

编辑'test/dummy/config/routes'文件阅读:

Rails.application.routes.draw do
  mount RailsBlogEngine::Engine => "/blog"
end
Run Code Online (Sandbox Code Playgroud)

...和'config/routes'读取:

RailsBlogEngine::Engine.routes.draw do
  resources :posts
end
Run Code Online (Sandbox Code Playgroud)

我想列出为':posts'生成的路线,但目前尚不清楚我是如何做到这一点的.当我运行'rake app:routes'时,我只获得"/ blog"路线:

$ rake app:routes
rails_blog_engine    /blog    {:to=>RailsBlogEngine::Engine}
Run Code Online (Sandbox Code Playgroud)

当我运行'rake routes'时,我收到一个错误:

$ rake routes
rake aborted!
Don't know how to build task 'routes'
Run Code Online (Sandbox Code Playgroud)

我怎样才能看到':posts'的路线?我可以不重写相关的rake任务吗?

routes ruby-on-rails rails-routing rails-engines ruby-on-rails-3.1

21
推荐指数
2
解决办法
7601
查看次数