[Rails]form_forで、エラー”ActionView::Template::Error (undefined method xxx_path…”が出るときすべきこと

Ruby on Railsでモデルを作り、viewの中でform_forヘルパーメソッドを利用したとき、下記のようなエラーが出る場合があります。
ActionView::Template::Error (undefined method `users_path’ for …)

このような場合は、routes.rbに下記の定義を追加するとうまくいくかもしれません。
下記は、Usersモデルを使用している場合の例です。

resources :users




参考:
http://stackoverflow.com/questions/8706774/undefined-method-with-path-while-using-rails-form-for

関連記事

One Response to “[Rails]form_forで、エラー”ActionView::Template::Error (undefined method xxx_path…”が出るときすべきこと”

コメントを残す

メールアドレスが公開されることはありません。