28 Nov 2004

Rails GTD application

I've decided that the GTD Todo application I've been developing is probably now in a state where I feel comfortable about distributing it. It's certainly not finished in any sense of the word, and has lots of bugs. For that reason, I can't stress enough that you shouldn't use it for your precious data—I can't guarantee that it won't ruin your life in some way, and I don't want to be responsible for that. It's really for people who are learning Ruby or Rails, and are curious about what can be done by an absolute beginner (i.e. me). You can download the zip file here—the installation instructions are in a README in todo/docs. You also need to have Ruby 1.8.x, mySQL and Rails 0.8 installed.

Needless to say, I'd be really grateful for any bug-fixes or suggestions for ways that it could be improved. It's a bit messy at the moment, and some things aren't fully implemented. I've developed it with the GTD method in mind, so the main page shows all your actions sorted by context. You can add new items on that page too, so adding and viewing actions is as easy as possible. There are a few other features:

  • Due dates are very much optional, but if you add a due date (YYYY-MM-DD format), it is displayed with a coloured background, depending on how far away the date is. If it's due today, tomorrow or overdue, the background is red. If it's due in the next 7 days, it's orange—otherwise it's green. It's basically a traffic light code.
  • The last five completed items are shown at the bottom of the main page, with the most recently completed item last. But you can see all your completed items on the todo/completed page. Eventually, I want to sort this page nicely by date, and also add a search facility.
  • If you have BlueCloth installed, you can add notes in Markdown format. Items with notes show a small note icon, and if you click this, you can toggle the display of notes. There's also a link to show or hide all notes at the top of most pages.
  • Sometimes you want to focus just on one context at a time so that you can rip through all of your calls, for example, without getting distracted by other things. If you click on the context heading on the main page, you'll be taken to a page showing just the items in that context.
  • Projects are also supported. You can add and edit projects on the project/list page. Once on that page, clicking any of the project names will show you all of the action items associated with that project. Note that actions don't have to be part of a project, so the New Item form adds an empty field for the project by default.

Some things aren't finished yet. You can only add new items from the main page, which is slightly awkward when you want to add a load of actions to a project in a batch. I'm also using the 'scaffold' version of the edit action at the moment, so while it works, it doesn't fit in well with the rest of the app. I have some plans for other features to add, but I'm exhausted now, so I'll write about them later. Enjoy!

Update: In my tiredness yesterday, I forgot to properly credit Vince's todo tutorial, which formed the basis of my app. I'm not sure that I would have been able to get started without it.

Update 2: One more thing. Someone pointed out to me that I'm using the same database name as Vince's app, which is a really stupid rookie move on my part, and entirely due to my failure to be imaginative in naming things. So if you're already using Vince's app, hold off on installing mine for now. I'll have a go at changing the namespace of my app in the next version so that they don't conflict. [Hits forehead repeatedly...] Stick to the day job, bsag.

  1. 1

    heh, I just added your site to my feed reader because I wanted to see if that GTD/Rails app ever made it into anything, and minutes later; it did! wink Anyway, looks cool, I'm waiting for my copy of "The Book" (ie. Getting Things Done) to see whats all this fuzz is about and whether it can help my procrastination or not. Anyway, as a fellow Rails user I took a quick look at the code (and partly because I'm working on something thats kinda similar), and wanted to give you a few pointers: This: redirect_to( :action => "../../todo/list" ) Would be more "Rails like" if you wrote it like this: redirect_to(:controller => 'todo', :action => 'list') When you're showing a project you're using find_all(). If you just want one and you know the id there's no need for that when there's the find() method, it accepts the id as the parameter (like Project.find(@params["id"])) unless I misunderstood your intentions from taking a quick glimpse at the code. Anyway, keep the fun you seem to be having with Rails/Ruby! And don't forget to drop by #rubyonrails if you're in trouble..----- johan: Ah, the :controller => thing was what I was missing—that's really useful. I had a similar problem trying to redirect the project/show/<n> page back again after a new item had been added. That's why I took out the new item form on that page for now. Excellent. I'll update that when I get a chance. You're right that a more specific find would be much more efficient. That's one of the many bits of messy code left in because I changed my mind about structure. I initially thought that I would display all of the projects on the one page (hence the find_all()) then decided it would be neater to show just one. I never got around to changing the method, but I'll do that in the next revision. Anyway, thanks for all the tips! If you spot anything else, do let me know. I know that there are lots of potential problems with it, but I wanted to get it out there for people to pull apart. I also forgot to add that the CSS and icons are very rough, and are just meant to indicate how I want it to look in the end.</n>

    by bsag @ 28/11/2004 7:11 pm • Permalink

  • 2

    Wow, your application looks really great. I really like the GTD method, but I haven't been able to get Rails running on my Mac. Do you know of any sites that can help me get Rails installed? I've got Instiki running, so I think I've got the right version of Ruby....

    by JP @ 29/11/2004 3:11 am • Permalink

  • 3

    JP: I presume that you've tried the installation instructions here? Making sure that the right version of Ruby is installed properly is very important. I had to rename the version that comes with Panther to ruby_apple as suggested on that page. I installed the gem version of Rails, and that seemed to go fine, so I'm not sure what else to suggest. One gotcha with the gem installation is to make sure that you install the latest version of Ruby Gems first, otherwise updating or installing Rails 0.8.x will fail. You could try the IRC channel (irc.freenode.net#rubyonrails) - they are really helpful. Curt Hibbs: It's in the top level of the folder: a file named Todo_dump 28.11.2004.sql. You should be able to use that to import the database schema and some test content. I tried it with CocoaMySQL, and it works fine. If all else fails, it's just a text file, so you should be able to use it to construct the correct structure yourself.

    by bsag @ 29/11/2004 2:11 pm • Permalink

  • 4

    Curt, look in the Todo_Dump file.

    by Daniel Von Fange @ 29/11/2004 2:11 pm • Permalink

  • 5

    I downloaded your zip file and I would like to try it out, but I don't see your database schema anywhere in there. Could you please post it? Thanks, Curt

    by Curt Hibbs @ 29/11/2004 2:12 pm • Permalink

  • 6

    Fou nd the SQL file... Thanks! If it had been any more obvious, I would have tripped over it! Too bad I can't blame it on being Friday. :-(

    by Curt Hibbs @ 29/11/2004 4:11 pm • Permalink

  • 7

    I got it working under Windows! Instructions: This assumes you already have Ruby, Gem and Rails installed. --Easy Way-- Unzip ruby.zip in your Ruby installation directory to install Ruby-SQLite. Then unzip todo.zip in the todo directory (selecting Yes if prompted to overwrite files). Then you can run the program with 'ruby dispatch.servlet -c'. (Windows does not support the -d daemon switch.) --Hard Way-- * Grab 'sqlite-ruby-2.2.2-msvcrt-bin.zip' from here, unzip and run install.rb to install. * Get the SQLite dll from here and unzip to C:rubybin (or wherever you installed ruby). * Change database.yml to the following: production: adapter: sqlite dbfile: ../db/rails-production.db * Create a directory 'db' under todo and copy Todo_dump 28.11.2004.sql to it as dump.sql. * Download and unzip the 2.8.15 version of the SQLite command-line client to this directory. * dump.sql is not in the format that SQLite expects. You'll need to search and replace all backticks (`) with apostrophes/single quotes ('). Also, delete all occurences of 'Type=MyISAM' and 'PRIMARY KEY ('id'). Replace '`id` int(11) NOT NULL auto_increment,' with ''id' INTEGER PRIMARY KEY, '. * Now, create the database by running: sqlite rails-production.db .read dump.sql .quit * Done! Run using 'ruby dispatch.servlet -c'. You could try 'rubyw dispatch.servlet -c' for the daemonic version, but this gives me 'Bad file descriptor' problems, same as I get with Instiki.

    by jobby @ 29/11/2004 7:12 pm • Permalink

  • 8

    Curt Hibbs: No problem. I'd blame it on Monday if I were you—Monday is far more deadly than Friday. grin jobby: [I hope you don't mind that I edited your comment in a very minor way—you had some unclosed <a> tags which were making things a bit weird] Like an idiot, I forgot that not everyone runs MacOSX or a *nix, so thanks so much for the instructions. Wow. After all that work, trying out todo must have been a real let-down :-(. Sorry about that.

    by bsag @ 29/11/2004 8:11 pm • Permalink

  • 9

    bsag: Don't sell yourself short! It wasn't a let-down at all. I know nothing about GTD but I found that this app really intuitive to use and a good fit for how I work. As for the instructions, I only went to so much effort because I was too lazy to bother setting up a MySQL server (in which case the app would have run fine with the given instructions). That doesn't make a lot of sense, but then my language of choice is perl grin I'm looking forward to the next version. PS: There are some odd rendering errors under Opera 7.60 (text escaping the boundaries of the boxes), but no show stoppers.

    by jobby @ 29/11/2004 10:12 pm • Permalink

  • 10

    links for 2004-11-30 darcs Hello, I'm David Roundy, the author of darcs. Darcs is a replacement for CVS. Darcs is simple to...

    by fozbaca.org @ 30/11/2004 6:12 am • Permalink

  • 11

    jobby: Thanks! Yes, the CSS is very rough at the moment, and is meant to just give the general idea. I'll clean it up later when I've got the functions fixed.

    by bsag @ 30/11/2004 8:11 pm • Permalink

  • 12

    Bit of trouble here. I've got it installed on my debian system, but hitting the page gives me no data, and the log shows some delightful errors and stack dumps: Exception throw during dispatch: undefined method `create_new_id' for CGI::Session:Class /usr/lib/ruby/1.8/cgi/session.rb:264:in `initialize' /usr/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/cgi_process.rb:70:in `new' /usr/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/cgi_process.rb:70:in `session' ... Exception throw during dispatch: undefined method `create_new_id' for CGI::Session:Class /usr/lib/ruby/1.8/cgi/session.rb:264:in `initialize' /usr/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/cgi_process.rb:70:in `new' /usr/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/cgi_process.rb:70:in `session' ... Exception throw during dispatch: undefined method `create_new_id' for CGI::Session:Class /usr/lib/ruby/1.8/cgi/session.rb:264:in `initialize' /usr/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/cgi_process.rb:70:in `new' /usr/lib/ruby/gems/1.8/gems/actionpack-0.9.5/lib/action_controller/cgi_process.rb:70:in `session' ... Exception throw during dispatch: No such file to load -- list_controller /usr/local/lib/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in `require__' /usr/local/lib/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in `require' /usr/lib/ruby/gems/1.8/gems/rails-0.8.5/lib/dispatcher.rb:34:in `dispatch' /var/www/todo/public/dispatch.rb:10 /usr/lib/ruby/gems/1.8/gems/rails-0.8.5/lib/webrick_server.rb:97:in `load' ... Any hints? Ruby isn't yet among my fluencies, although it is, to put it foolishly, on my to-do list. --G

    by Grant Gould @ 01/12/2004 8:13 pm • Permalink

  • 13

    Grant Gould: A few things to check: On my machine, Ruby, Gems and everything else got installed under the /usr/local/ tree, rather than /usr as indicated in the logs. It might be that you specified that destination, or that Ruby installs there on Linux, but it's worth checking. For whatever reason, it doesn't seem to be finding the Rails methods relating to the dispatch script. Also, did you check that you have BlueCloth.rb installed? I need to make it check for the module in future, but at the moment it will just fail silently. Finally, I see that you are using rails 0.8.5, but I built the app against 0.8 (heh, I know—I'm a bit out of date). I don't think that there's anything new in 0.8.5 which might break gtd, but I can't be sure. Anyone else using 0.8.5 with this app?

    by bsag @ 02/12/2004 2:12 pm • Permalink

  • 14

    Good thoughts! I'll give them a try. I'm pretty sure I've got bluecloth in, but the install path problem sounds like exactly the thing. I'll post again when I've got a result. Thanks! I look forward to trying out your app. --G

    by Grant Gould @ 02/12/2004 2:13 pm • Permalink

  • 15

    Sorry to turn this into a huge troubleshooting thread but..... When I load the page I first get a blank page and reloading gives me a 'Not Found' page that says : /todo/list' not found I installed Ruby & Rails following instructions from the link above (for Mac OSX). I did install Rails at the root level of my home directory rather than in the sites folder as was suggested. Any thoughts? Error message follows. Thanks, John Exception throw during dispatch: uninitialized constant TodoController /usr/local/lib/ruby/gems/1.8/gems/rails-0.8.5/lib/dispatcher.rb:35:in `const_get' /usr/local/lib/ruby/gems/1.8/gems/rails-0.8.5/lib/dispatcher.rb:35:in `dispatch' /Users/johnyoung/Sites/todo/public/dispatch.rb:10 /usr/local/lib/ruby/gems/1.8/gems/rails-0.8.5/lib/webrick_server.rb:97:in `load' /usr/local/lib/ruby/gems/1.8/gems/rails-0.8.5/lib/webrick_server.rb:97:in `handle_dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-0.8.5/lib/webrick_server.rb:75:in `handle_mapped' /usr/local/lib/ruby/gems/1.8/gems/rails-0.8.5/lib/webrick_server.rb:30:in `do_GET' /usr/local/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in `__send__' /usr/local/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in `service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:92:in `service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:54:in `run' /usr/local/lib/ruby/1.8/webrick/server.rb:150:in `start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:144:in `start' /usr/local/lib/ruby/1.8/webrick/server.rb:144:in `start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:94:in `start' /usr/local/lib/ruby/1.8/webrick/server.rb:89:in `each' /usr/local/lib/ruby/1.8/webrick/server.rb:89:in `start' /usr/local/lib/ruby/1.8/webrick/server.rb:79:in `start' /usr/local/lib/ruby/1.8/webrick/server.rb:79:in `start' /usr/local/lib/ruby/gems/1.8/gems/rails-0.8.5/lib/webrick_server.rb:17:in `dispatch' public/dispatch.servlet:45

    by John Y @ 03/12/2004 4:12 am • Permalink

  • 16

    Grant's problem (comment #13) is in ruby libraries itself, not in the GTD application... There is really a bug in session.rb. Fix is easy, see: http://comments.gmane.org/gmane.comp.lang.ruby.core/3152

    by Jozef Fulop @ 05/12/2004 10:13 pm • Permalink

  • 17

    Mr. Fulop: Wonderful! Brilliant! Exactly what I was looking for. And now that I have this thing working, bsag: Wonderful! Brilliant! Exactly what I was looking for. I can tell already that this app will be a great deal of useful fun. --G

    by Grant Gould @ 06/12/2004 3:12 pm • Permalink

  • 18

    Deleting projects gives a not-so-nice error, " ActionView::ActionViewError in Project#destroy: No rhtml or rxml template found for project/destroy." Fair enough, no great disaster there. But now any attempt to go to the list page gives a " NoMethodError in Todo#list Showing /todo/list.rhtml: line #34 raised undefined method `[]' for nil:NilClass " The problem with deletion seems to be exactly what the error says: It hasn't a page to display, and so does not display it. The problem with the list page seems to be that deleting a project does not delete todos that are members of the project, which in turn confuses the list page when it tries to work out how to display them. A simple manual delete in the database cleared the problem up for me, but that's probably not the optimal solution grin I'm still learning ruby, so I can't quite offer a patch at this stage. Sorry. --G

    by Grant Gould @ 06/12/2004 3:13 pm • Permalink

  • 19

    Josez or Grant, can you give me some pointers on how to apply the patch mentioned in #17? I think my Ruby installation suffers from the same problems that previously plagued Grant (no data returned to browser), but I am not familiar enough with UNIX commands to update the session.rb file with the patch Josez linked to. FWIW, I'm running Ruby 1.8 on Mac OS X.3. Thanks, JP

    by JP @ 06/12/2004 10:12 pm • Permalink

  • 20

    John Y: Hmm. Unless this is part of the same problem as Grant had (which doesn't seem likely), could it be that you don't have BlueCloth installed (see #14)? Jozef Fulop: Thanks! That's a big help. Is this a recent problem? I haven't come across it using 1.8.1. Grant: Urg. Nasty bug. For me, the Project gets deleted, but as you point out, you then get an error because it doesn't delete todos in that project (I have to think how to handle this anyway, because it's potentially destructive behaviour). Sorry about that. As for the fact that you got the error deleting, that would suggest that it couldn't delete the project entry in your database (if it's sucessful, it reloads the project/list page—not doing something sensible if there's an error is another bug hmmm ). But this suggests that there may be a problem with your database. Are you sure that the ID number of the project you were trying to delete exists? And that the user you connect to the DB as has full read, write and delete privileges? I'm sure you'll all be glad to know that I'm carefully studying Steve Kellock's excellent Rails Testing Tutorial. So with any luck, the next version should be properly tested, rather than—er—not tested at all.

    by bsag @ 06/12/2004 11:12 pm • Permalink

  • 21

    Sorry, but I'm confused by the installation instructions. I'm on Windows XP, and I read the Windows instructions above. I have apache and mysql installed, and working just fine. I have ruby and rails installed, and have worked through the "friends" tutorial on rubyonrails.org. I read bsag's README, and I assume the "Sites" file means my Apache htdocs directory. I guess the question is how to download and install an application someone else created? This isn't obvious to me. When I make my own rails apps, they get put in %RAILS%app. Do I overwrite my whole rails installation with the folders in gtd_app.zip? That doesn't seem right. If I tell winzip to make another "todo" folder somewhere, in or out of the htdocs folder, running the dispatch.servlet command doesn't work for me. The WEBrick console says it can't find /todo. Help!

    by Brian Doherty @ 07/12/2004 12:12 am • Permalink

  • 22

    I went through the install again on another computer that I have and it worked fine. Went back to the Powerbook and started the webrick again. This time it worked fine. So, unfortunately, I don't know what fixed it. It could have been the restart after installing BlueCloth or the fact that at first, I didn't have it in the 'Sites' folder. Whatever, it works now. Which leads me to a question. Do you have to issue the command 'ruby public/dispatch.servlet -d -c' after every reboot? Thanks

    by John Y @ 07/12/2004 6:12 am • Permalink

  • 23

    bsag; i (accidentally) reproduced the bug that grant is talking about. like him, i had to manually delete the todos to get anything to load again. still, this is an excellent program! just what i was looking for. simple, elegant, and it uses GTD! -----

    by rac @ 11/12/2004 10:13 pm • Permalink