I’m a fairly nooby Rails developer of very little brain, and this error
had me confused for the last several hours.
It’s a very simple (unfinished) Rails app. It has a model called Tasks.
has a very basic routes.rb
root :to => ‘tasks#index’
A vanilla controller (create action not properly defined yet because
would have been next on the list when I ran into this problem)
class TasksController < ApplicationController
@tasks = Tasks.all
@task = Tasks.new
And a view for the /tasks/new action
Create new task<%= form_for @task do |form| %> <%= lots of form. blah blah here... %> <% end %>
And when the view is rendered I get the following error:
undefined method `tasks_index_path’ for
Extracted source (around line #2):
Create new task
2: <%= form_for @task do |form| %>
And here are the top few lines of the stack trace:
polymorphic_url' actionpack (3.0.0) lib/action_dispatch/routing/polymorphic_routes.rb:120:inpolymorphic_path’
actionpack (3.0.0) lib/action_view/helpers/form_helper.rb:335:in
apply_form_for_options!' actionpack (3.0.0) lib/action_view/helpers/form_helper.rb:307:inform_for’
I don’t really understand where “tasks_index_path” came from or why
has bombed out so spectacularly, especially given how simple the code is
right now. Can anyone point me at what I might be doing wrong?
Oh yes, it’s rails 3.0.0 on ruby 1.9.2 running on Ubuntu 10.04.