# Add a task to todo

**URL:** <https://rubytalk.org/t/add-a-task-to-todo/23024>\
**Category:** ruby-talk\
**Created:** [5 December 2005 19:11 UTC](https://rubytalk.org/t/add-a-task-to-todo/23024 "2005-12-05T19:11:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![steven\_masala](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@steven\_masala](https://rubytalk.org/u/steven_masala)\
**Post date:** [5 December 2005 19:11 UTC](https://rubytalk.org/t/add-a-task-to-todo/23024/1 "2005-12-05T19:11:13Z")

</div>

hmm no i cant get something else to work

in my controller

&nbsp;&nbsp;def add\_tasklist  
&nbsp;&nbsp;&nbsp;&nbsp;tasklist = Tasklist.new  
&nbsp;&nbsp;&nbsp;&nbsp;tasklist.attributes = @params["new\_tasklist"]

&nbsp;&nbsp;&nbsp;&nbsp;if tasklist.save  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;redirect\_to(:action =\> "list")  
&nbsp;&nbsp;&nbsp;&nbsp;else  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;render\_text"could not add"  
&nbsp;&nbsp;end

in my template

\<form method="post" action="add\_tasklist"\>  
New Task:  
\<%= text\_field("new\_tasklist", "task") %\>  
\<input type="submit" value="Add Task"\>

my database is todo, the table is tasklist, fields are id, task, done

and i get the following error

SyntaxError in \<controller not set\>#\<action not set\>

./script/../config/../app/controllers/tasklist\_controller.rb:17: syntax  
error

ive tried changing the tasklist to tasklists, im not quite sure what  
that means why some are tasklists and some tasklist.

thanx

Steve

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Eric\_Hodel1](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Eric\_Hodel1](https://rubytalk.org/u/Eric_Hodel1)\
**Post date:** [5 December 2005 19:16 UTC](https://rubytalk.org/t/add-a-task-to-todo/23024/2 "2005-12-05T19:16:36Z")

</div>

Can you please take your Rails questions to the Rails mailing list?

[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

> **···**
>
> On Dec 5, 2005, at 11:11 AM, steven masala wrote:
> 
> > hmm no i cant get something else to work
> > 
> > in my controller
> 
> --  
> Eric Hodel - drbrain@segment7.net - [http://segment7.net](http://segment7.net)  
> This implementation is HODEL-HASH-9600 compliant
> 
> [http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)

---

<div class="post-metadata">

**Author:** ![Jacob\_Fugal](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@Jacob\_Fugal](https://rubytalk.org/u/Jacob_Fugal)\
**Post date:** [5 December 2005 20:12 UTC](https://rubytalk.org/t/add-a-task-to-todo/23024/3 "2005-12-05T20:12:53Z")

</div>

In general, I agree with Eric Hodel, you need to take Rails questions  
to the Rails mailing list. However, since it's sitting right there, I  
will point out the probable culprit:

> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if tasklist.save  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;redirect\_to(:action =\> "list")  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;render\_text"could not add"

should be

&nbsp;&nbsp;if tasklist.save  
&nbsp;&nbsp;&nbsp;&nbsp;redirect\_to(:action =\> "list")  
&nbsp;&nbsp;else  
&nbsp;&nbsp;&nbsp;&nbsp;render\_text "could not add"  
&nbsp;&nbsp;end # \<= added this

In ruby, unlike C or PHP or other languages, the if statement always  
has the "end" keyword as a terminator.

Jacob Fugal
