0
私は少しのRails CMSを書いていますが、ルーティングエラーが多少残っています。まず、Entry
という基本モデルを継承しています。私は既存のモデルを編集しようとすると、それは私が、以下の持っている私のroutes.rb
CMSでプラグインでは私にエラー編集方法のルーティングエラー
No route matches [PATCH] "/admin/posts/entries"
を返します。
Multiflora::Engine.routes.draw do
root "dashboard#index"
scope "/:content_class" do
resources :entries
end
end
とテストアプリの私が持っているroutes.rb
mount Multiflora::Engine, at: '/admin'
application_controller.rb
私も少し経路を微調整しました:
def content_entries_path
entries_path(content_class: content_class.tableize)
end
helper_method :content_entries_path
def content_entry_path(entry)
entry_path(entry, content_class: content_class.tableize)
end
helper_method :content_entry_path
def new_content_entry_path
new_entry_path(content_class: content_class.tableize)
end
helper_method :new_content_entry_path
def edit_content_entry_path(entry)
edit_entry_path(entry, content_class: content_class.tableize)
end
helper_method :edit_content_entry_path
そして、私のshow.html.erb
に私はこれを持っている:
<%= link_to 'Edit', edit_content_entry_path(@entry) %>
私はedit_content_entry_path
に移動すると、それは正しく私の編集ページを示しているが、私は編集したエントリを保存しようとすると、それは私に上記のエラーを返します。私はrake routes
を実行すると、それは次のように私を返します。
entries GET /:content_class/entries(.:format) multiflora/entries#index
POST /:content_class/entries(.:format) multiflora/entries#create
new_entry GET /:content_class/entries/new(.:format) multiflora/entries#new
edit_entry GET /:content_class/entries/:id/edit(.:format) multiflora/entries#edit
entry GET /:content_class/entries/:id(.:format) multiflora/entries#show
PATCH /:content_class/entries/:id(.:format) multiflora/entries#update
PUT /:content_class/entries/:id(.:format) multiflora/entries#update
DELETE /:content_class/entries/:id(.:format) multiflora/entries#destroy