0
我想讓我的第一個Ror應用程序,這裏是我的第一個問題:)爲什麼我需要'show.html.erb'模板去'.../posts/index'?
當我到localhost:3000/posts/index,我得到消息'Missing template posts/show,application/show with { :locale ...'爲什麼是這樣?爲什麼我需要show.html.erb模板的posts/index?
routes.rb
後$rake routes
命令文件
Rails.application.routes.draw do
resources :posts
root 'posts#index'
end
路線:
Prefix Verb URI Pattern Controller#Action
posts GET /posts(.:format) posts#index
POST /posts(.:format) posts#create
new_post GET /posts/new(.:format) posts#new
edit_post GET /posts/:id/edit(.:format) posts#edit
post GET /posts/:id(.:format) posts#show
PATCH /posts/:id(.:format) posts#update
PUT /posts/:id(.:format) posts#update
DELETE /posts/:id(.:format) posts#destroy
root GET / posts#index
謝謝James :) – Alek