1
目前我正在研究RoR中的博客引擎,並遇到與路由有關的severa問題。 的routes.rb
看起來是這樣的:重寫Rails路線
match '/admin', :to => 'posts#new'
match '/get/:id', :to => 'posts#get'
match '/new', :to => 'posts#new'
delete '/:id', :to => 'posts#destroy'
post '/edit/:id', :to => 'posts#update'
put '/edit/:id', :to => 'posts#update'
get '/edit/:id', :to => 'posts#new', :as => 'post'
get '/:slug', :to => 'posts#show', :as => 'post'
root :to => 'posts#index'
,我想改造它是這樣的:
resources :admin do
resources :posts
end
任何幫助將是非常讚賞。