简体   繁体   English

Rails 4.1.5引擎的路线未在耙路中显示-相信它的命名约定

[英]Rails 4.1.5 Engine's Routes Not Showing Up In Rake Routes — Believe It's Naming Convention

So I am working on trying to add a Rails 4.1.5 engine/plugin to our project which are then loaded by rails. 所以我正在尝试将Rails 4.1.5引擎/插件添加到我们的项目中,然后由Rails加载。 Running rake routes shows the other engines which I have modeled my code after but I believe I may be running into issues with Rails naming conventions which I am not familiar with. 运行rake routes显示我为模型建模之后的其他引擎,但是我相信我可能会遇到我不熟悉的Rails命名约定问题。 For the purpose of I've created the engine using the following command: 为了达到目的,我使用以下命令创建了引擎:

rails plugin new modules/admin/new_functions --skip-bundle --full

This created the skeleton for the engine. 这为引擎创建了骨架。 I ensured that I used a plural name for the engine per this piece of Rails documentation. 我确保在 Rails文档中,我为引擎使用了复数名称。 My controller is: 我的控制器是:

module Admin
    class NewFunctionsController < AdminController
        def index
        end

        def create
        end
    end
end

My config/routes.rb file is as follows. 我的config/routes.rb文件如下。 I'm unsure if the resources :new_functions correctly maps to the controller I have but I'm not sure what the correct form would be. 我不确定资源:new_functions是否正确映射到我拥有的控制器,但是我不确定正确的格式是什么。

Rails.application.routes.draw do
    namespace :admin do
        resources :new_functions
    end
end

The directory structure is: 目录结构为:

new_functions
|-- app
    |-- assets
          |-- javascripts
              |-- admin
                  |-- new_functions
                      |-- supporting javascript files
    |-- controllers
          |-- new_functions_controller.rb
    |-- views
          |-- admin
              |-- new_functions
                  |-- supporting HTML/ERB files
|-- config
    |-- routes.rb
|-- lib
    |-- new_functions.rb
    |-- new_functions
          |-- engine.rb
          |-- version.rb
|-- test
    |-- new_functions_test.rb
    |-- test_helper.rb
|-- Gemfile
|-- Gemfile.lock
|-- Rakefile
|-- new_functions.gemspec

Would greatly appreciate any advice that you may have regarding identifying this issue and fixing it. 非常感谢您提出的有关识别和解决此问题的建议。 Any steps or reading that I can do to find the issue would also be helpful. 我可以执行任何发现问题的步骤或阅读材料也将有所帮助。

Thank you all for your time. 谢谢大家的时间。

After further research it seems as though someone had added "Spring" to the application, which caches rake routes . 经过进一步研究,似乎有人在该应用程序中添加了“ Spring”,以缓存rake routes Stopping spring bin/spring stop and then running rake routes fixed the issue with the routes not appearing. 停止弹簧bin/spring stop ,然后运行rake routes解决了路径不出现的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM