Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails error "NoMethodError" - My first ruby app

I am absolutely and totally new to rails, so the answer is probably very simple. Here goes:

My page is generating this error

NoMethodError in Tasks#new
Showing app/views/tasks/new.erb where line #3 raised:

undefined method `tasks_path' for #

Here is the view:

<% form_for(@task) do |f| %>
    <%= f.error_messages %>

    <%= f.label :description %>:
    <%= f.text_field :description %><br />

    <%= f.label :priority %>:
    <%= collection_select(:news, :priority_id, Priority.find(:all), :id, :description) %><br />

    <%= f.submit "Add Task" %>

<% end %>

The controller:

class TasksController < ApplicationController
    def index
        @all_tasks = Task.find(:all, :order => :id)
    end

    def new
        @task = Task.new
    end ...(more)

and the model:

I can't see a problem, but like I said, I'm clueless so far. Thanks!

class Task < ActiveRecord::Base
    validates_presence_of :description

    belongs_to :priority
    has_and_belongs_to_many :staff
    has_and_belongs_to_many :catagory

end
like image 530
doctororange Avatar asked Dec 22 '22 11:12

doctororange


1 Answers

Do you have

map.resources :tasks

in your routes?

like image 97
Jarrod Avatar answered Jan 03 '23 16:01

Jarrod