Next → Eighth Step, Elements Sixth Step, open and close tasks ← Prev

Seventh Step, delete tasks

Well, creating, opening and closing work now, one of the things you will consider is to delete a task permanently.

This is just two little changes away, so let's add the link for deletion in our Controller:

delete = A('Delete', :href => Rs(:delete, title))
@tasks << [title, status, toggle, delete]

and an corresponding method while we're at it:

def delete title
  TodoList.delete title
  redirect Rs()
end

Now jumping to view/index.xhtml again, change it so it shows the link:

<?r @tasks.each do |title, status, toggle, delete| ?>
  <li>
    #{title}: #{status} [ #{toggle} | #{delete} ]
  </li>
<?r end ?>

VoilĂ , you now have acquired the Certificate of Ramazeness.

Just kidding, but that really are the basics, in the next few steps I will explain some more advanced concepts of Ramaze and Ezamar.

Next → Eighth Step, Elements Sixth Step, open and close tasks ← Prev

 
Back to top
tutorials/todolist-7.txt · Last modified: 2008/01/31 04:44 by reacher