[英]Rails 4.1.5 Engine's Routes Not Showing Up In Rake Routes — Believe It's Naming Convention
所以我正在嘗試將Rails 4.1.5引擎/插件添加到我們的項目中,然后由Rails加載。 運行rake routes
顯示我為模型建模之后的其他引擎,但是我相信我可能會遇到我不熟悉的Rails命名約定問題。 為了達到目的,我使用以下命令創建了引擎:
rails plugin new modules/admin/new_functions --skip-bundle --full
這為引擎創建了骨架。 我確保在此 Rails文檔中,我為引擎使用了復數名稱。 我的控制器是:
module Admin
class NewFunctionsController < AdminController
def index
end
def create
end
end
end
我的config/routes.rb
文件如下。 我不確定資源:new_functions是否正確映射到我擁有的控制器,但是我不確定正確的格式是什么。
Rails.application.routes.draw do
namespace :admin do
resources :new_functions
end
end
目錄結構為:
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
非常感謝您提出的有關識別和解決此問題的建議。 我可以執行任何發現問題的步驟或閱讀材料也將有所幫助。
謝謝大家的時間。
經過進一步研究,似乎有人在該應用程序中添加了“ Spring”,以緩存rake routes
。 停止彈簧bin/spring stop
,然后運行rake routes
解決了路徑不出現的問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.