我的routes.rb
:
DigitalizmAdmin::Application.routes.draw do
## Admin routes
namespace :mercury do
resources :images
end
mount Mercury::Engine => '/'
devise_for :admins #, :skip => [:registrations, :passwords]
namespace :admin do
root :to => "admin#dashboard"
resources :categories do
member { post :mercury_update }
end
resources :posts do
member { post :mercury_update }
end
resources :pages do
member { post :mercury_update }
end
end
## Regular routes
root to: "welcome#index"
get 'posts/*categories_uri/:post_uri' => "posts#show"
get 'categories/*categories_uri' => "categories#show"
# here is the regular page route
get 'page/:uri' => "pages#show", as: :page
get 'sitemap/*categories_uri' => 'sitemap#show'
get 'sitemap' => 'sitemap#index'
## Catch all unexisted routes
match "*path", to: "application#render_404", via: :all
end
这是我如何构建链接以在视图中进行编辑:
= link_to "Edit", "/editor" + page_path(item)
在路线上host/page/:slug
我可以看到页面,但是当我在路线上时host/edit/page/:slug
出现 404 错误。
在浏览器控制台中,我可以看到错误:
GET http://host/page/:slug?mercury_frame=true&_=1388132782182 404 (Not Found)
但所有水星编辑器的 js 文件都已加载。