fork download
  1. public with sharing class TodoController {
  2.  
  3. public List<Todo__c> todos {get;set;}
  4. public Todo__c newTodo {get;set;}
  5.  
  6. public TodoController() {
  7. todos = [SELECT Id, Description__c, Status__c FROM Todo__c WHERE Status__c = 'Pending'];
  8. newTodo = new Todo__c();
  9. }
  10.  
  11. public void addTodo() {
  12. insert newTodo;
  13. todos.add(newTodo);
  14. newTodo = new Todo__c(); // Reset for next addition
  15. }
  16.  
  17. public void markAsCompleted(Todo__c todo) {
  18. todo.Status__c = 'Completed';
  19. update todo;
  20. todos.remove(todo);
  21. }
  22.  
  23. }
Success #stdin #stdout #stderr 0.01s 8908KB
stdin
Standard input is empty
stdout
Object: nil error: did not understand #with
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
UndefinedObject(Object)>>doesNotUnderstand: #with (SysExcept.st:1448)
UndefinedObject>>executeStatements (prog:1)
stderr
./prog:3: parse error, expected '}'