学校のプロジェクトとして Ruby on Rails でゲームを作成していますが、次のエラーで立ち往生しています。
未定義のメソッド `storylines_index_path' for #<#:0x007ff34cca8f68>
ストーリーラインを追加するためのフォームが必要なページを作成しているので、いくつかのフィールドを含むフォームが必要です。form_for メソッドを使用したいと思います。しかし、追加するとこのエラーが発生します
これが私のコードです:
ビュー/new.html.erb
<% provide(:title, 'Overzicht Storylines') %>
<h1>Voeg nieuwe storyline toe</h1>
<%= form_for(@storyline) do |f| %>
<%= render 'shared/error_messages' %>
<%= f.label :title %>
<%= f.text_field :title%>
<%= f.submit "Create my account", class: "btn btn-large btn-primary" %>
<% end %>
storylines_controller.rb
class StorylinesController < ApplicationController def index
@storylines = Storylines.find(:all) end
def show
@storyline = Storylines.find(params[:id])
end
def new
@storyline = Storylines.new end end
ストーリーライン.rb
class Storylines < ActiveRecord::Base
attr_accessible :title, :text
end
ルート.rb
StoryLine::Application.routes.draw do
get "users/new"
get "storylines/new"
resources :users
resources :storylines
resources :sessions, only: [:new, :create, :destroy]
match '/signup', to: 'users#new'
match '/signin', to: 'sessions#new'
match '/signout', to: 'sessions#destroy', via: :delete
root to: 'static_pages#home'
match '/help', to: 'static_pages#help'
match '/contact', to: 'static_pages#contact'
match '/about', to: 'static_pages#contact'
match '/home', to: 'static_pages#home'
end