Railsアプリケーションを作っています。ユーザーが登録した後 (devise で既にユーザー登録を作成しています)、プロファイル情報を含むこのフォームに入力できます。私はこれを数回行いましたが、何が間違っているのかわかりません。モデルは次のとおりです。
class Information < ActiveRecord::Base
belongs_to :user
end
コントローラーは次のとおりです。
class InformationsController < ApplicationController
def new
@information = Information.new
end
def create
@information = Information.create(params[:information])
redirect_to student_path
end
def index
end
end
そして、これが新しいアクションのビューです。
<div class="span6 offset3 text-center">
<h1>Edit your information</h1>
<%= simple_form_for @information do |f| %>
<%= f.input :skills %>
<%= f.input :looking_for, :label => 'What help do you need?' %>
<%= f.input :my_idea %>
<%= submit_tag "Save", :class => "btn btn-primary btn-large" %>
<% end %>
</div>
ルートファイルの行は次のとおりです。
resources :informations
私には意味のない次のエラーが表示されます。
#<#:0x007f9c00c7b3e0> の未定義のメソッド `information_index_path'
これを修正する方法を知っている人はいますか?ありがとう。
アップデート:
ルートをレーキしたとき、フォームが行くべきである情報#作成のために、空白のパスがあります。informations#index もありますが、これは私が推測しているものです。パスが空白の場合に informations#create に移動するにはどうすればよいですか?