2011-11-09 2 views
0

레일즈 3가있는 간단한 CMS를 만들고 있습니다. routes.rb 파일에 다음 경로가 있습니다.Rails3 라우팅 우선 순위

match '*url', :controller => 'site', :action => 'dynamic_page' 

편집기 지원을 위해 ckeditor 보석을 사용하고 있습니다. 내 rake routes 다음과 같습니다 :

      root  /(.:format)        {:action=>"index", :controller=>"site"} 
           /*url(.:format)       {:action=>"dynamic_page", :controller=>"site"} 
     ckeditor_pictures GET /ckeditor/pictures(.:format)    {:action=>"index", :controller=>"ckeditor/pictures"} 
     ckeditor_pictures POST /ckeditor/pictures(.:format)    {:action=>"create", :controller=>"ckeditor/pictures"} 
     ckeditor_picture DELETE /ckeditor/pictures/:id(.:format)   {:action=>"destroy", :controller=>"ckeditor/pictures"} 
ckeditor_attachment_files GET /ckeditor/attachment_files(.:format)  {:action=>"index", :controller=>"ckeditor/attachment_files"} 
ckeditor_attachment_files POST /ckeditor/attachment_files(.:format)  {:action=>"create", :controller=>"ckeditor/attachment_files"} 
ckeditor_attachment_file DELETE /ckeditor/attachment_files/:id(.:format) {:action=>"destroy", :controller=>"ckeditor/attachment_files"} 

볼 수 있듯이 내 문제가 있습니다.

/*url(.:format)  {:action=>"dynamic_page", :controller=>"site"} 

..로드하기 전에 ckeditor 경로 및 따라서 ckeditor 경로가 작동하지 않습니다. 누군가가 전에 ckeditor 라우트를로드하는 데 도움을 줄 수 있습니까?

/*url(.:format)  {:action=>"dynamic_page", :controller=>"site"} 

미리 감사드립니다.

답변

1

routes 파일은 위에서 아래로 순서대로 처리되므로 catch-all이 ckeditor 항목 뒤에 오도록 경로 순서를 변경하십시오.

+0

안녕 @ 리차드 작업 이제 수동으로

namespace :ckeditor, :only => [:index, :create, :destroy] do resources :pictures resources :attachment_files end match '*url', :controller => 'site', :action => 'dynamic_page' 

처럼 routes.rb 파일에 감사를 ckeditor 경로를 추가 해낸 해결책하지만, 질문은 'ckeditor'경로가 'ckeditor'보석 경로에서 오는 것입니다. 하지만 다른 모든 라우팅은 config/routes.rb에 있습니다. – sameera207