add a task to todo

S

steven masala

hmm no i cant get something else to work

in my controller

def add_tasklist
tasklist = Tasklist.new
tasklist.attributes = @params["new_tasklist"]

if tasklist.save
redirect_to:)action => "list")
else
render_text"could not add"
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
 
J

Jacob Fugal

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:
if tasklist.save
redirect_to:)action =3D> "list")
else
render_text"could not add"

should be

if tasklist.save
redirect_to:)action =3D> "list")
else
render_text "could not add"
end # <=3D added this

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

Jacob Fugal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top