我在Ruby on Rails路由中遇到問題。Ruby on Rails「無法爲MessagesController找到操作'create'
配置/ routes.rb中:
Rails.application.routes.draw do
resources :messages
root to: 'dashboards#show'
end
應用程序/控制器/ messages_controller.rb:
class MessagesController < ApplicationController
def index
# Do current user messages select from database here
end
end
連結messges:
<%= button_to 'messages', messages_path %>
URL:
http://localhost:3000/messages
錯誤:
The action 'create' could not be found for MessagesController
爲什麼我有這個問題?我究竟做錯了什麼?爲什麼我得到這個錯誤?
如果我不需要什麼呢? – 2014-12-08 00:18:40
當然'缺少模板消息/創建,應用/創建{:locale => [:en],:formats => [:html],:variants => [],:handlers => [:erb,:建築師,:生,:紅寶石,:咖啡,:jbuilder]}。 – 2014-12-08 00:19:34