Forum: Ruby add a task to todo

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A29c862955ebed5e3f80308d2fab7360?d=identicon&s=25 Steven Masala (stevanicus)
on 2005-12-05 20:11

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
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 drbrain (Guest)
on 2005-12-05 20:17
(Received via mailing list)
On Dec 5, 2005, at 11:11 AM, steven masala wrote:

>
>
> hmm no i cant get something else to work
>
> in my controller

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

http://lists.rubyonrails.org/mailman/listinfo/rails

--
Eric Hodel - drbrain@segment7.net - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
Cff9eed5d8099e4c2d34eae663aae87e?d=identicon&s=25 lukfugl (Guest)
on 2005-12-05 21:14
(Received via mailing list)
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 => "list")
>                 else
>                         render_text"could not add"

should be

  if tasklist.save
    redirect_to(:action => "list")
  else
    render_text "could not add"
  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
This topic is locked and can not be replied to.