Sha256: 211826f98cb5fbd6bcb63e806fda419f28dd4491dec17540002385ff0584750f
Contents?: true
Size: 715 Bytes
Versions: 24
Compression:
Stored size: 715 Bytes
Contents
module TodoList class Tasks < Controller map '/' def index @tasks = Task.all @title = request[:title] end def create if request.post? and title = request[:title] title.strip! unless title.empty? Task.create :title => title end end redirect route('/', :title => title) rescue Sequel::DatabaseError => ex redirect route('/', :title => title) end def open(title) Task[:title => title].open! redirect r('/') end def close(title) Task[:title => title].close! redirect r('/') end def delete(title) Task[:title => title].destroy redirect r('/') end end end
Version data entries
24 entries across 24 versions & 4 rubygems