【发布时间】:2018-07-23 10:34:15
【问题描述】:
我已经创建了一个站点,并希望在上面有一个博客部分。但是,我不想将博客放在网站的索引页面上。
我创建了一个模型并生成了一个控制器,并按照https://scotch.io/tutorials/build-a-blog-with-ruby-on-rails-part-1上的说明进行操作
我唯一没有遵循的是这段代码: #config/routes.rb
Rails.application.routes.draw do
root to: "posts#index"
resources :posts
end
我想通过 localhost:3000/posts/ 进入帖子页面
我的根源是:
Rails.application.routes.draw do
mount Ckeditor::Engine => '/ckeditor'
get 'pages/index' => 'high_voltage/pages#show', id: 'index'
root :to => 'high_voltage/pages#show', id: 'index'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
resources :posts do
resources :index
resources :show
resources :edit
resources :new
resources :form
end
谢谢!
【问题讨论】:
标签: ruby-on-rails