〜Gauche on Railsへの道〜 3. ActiveController 風のものを作る。その3 〜

まだまだ完成度は超〜低いのですが、一応サーバー上で ActiveRecord風 + ActionController風 + ActionView(ERB)風 が動きました \(^^)/


(define-module todo
  (use active-record)
  (export <todo>))
(select-module todo)

(define-class <todo> (<active-record>) ())

(provide "todo")
(define-module todo-controller
  (use active-record)
  (use action-view)
  (use todo)
  (extend application-controller)
  (export index show new edit))
(select-module todo-controller)

(define-action index
  (set! @todos (find <todo> :all)))

 ・・・・
<h1>Listing todos</h1>
<table>
  <tr>
    <th>Due</th>
    <th>Task</th>
  </tr>

<% (for-each (lambda(todo) %>
  <tr>
    <td><%= (ref todo 'due) %></td>
    <td><%= (ref todo 'task) %></td>
  </tr>
<% ) @todos) %>
</table>

TODO

まだまだ続く・・・・ Orz