14 March 2006 in Code | Comments enabled

Details about how blindingly easy it was to make the cookbook

Following on from my install of RoR in the weekend I went through and did a tutorial. Nearly all the tutorials for RoR are for building a recipe book application so that was what I started with. I jumped on the tutorial at ONLamp.com which leads you through setting up RoR and starting your application.

For most of my readers this is a quick tutorial to run through – you can quickly skip over the database section and just download the SQL script (unless you don’t know about databases) and you’ll be up and running in no time. The only small issue I had with the tutorial was that it is about 1 year old and some things don’t quite apply any more. Some of these are addressed in part 2 of the tutorial.

So in no time at all I had my application so that I could add, edit, delete and list all the recipes in my collection. I also had a categories collection that the recipes belonged to (Snacks, Desserts etc) which you could also add, edit, delete and list. I updated the listing of recipes to allow you to display based on category as well.

The tutorial demonstrated what I thought was a cool tool:

rake stats

Rake is pretty much a Ruby version of Make and running it with the stats command gives you information about the lines of code in your application (How many lines in your controllers, model, tests etc) and also gives a nice ratio of lines of code to lines of tests. Nice. I like stats :-)

So my entire application ended up being 51 lines of code – 2 more lines than the example because I AJAXified the deletion of recipes from the list (you clicked delete and the row faded off). 51 lines seems insanely efficient for all that I was doing. I think I’m in love :)

Does anyone else have some RoR stories, experiences or horror stories they want to share?

- JD

Average Rating: 4.9 out of 5 based on 223 user reviews.

4 comments. Add your own comment.

Keith says 14 March 2006 @ 15:13

good to see more kiwis getting into RoR :)

traskjd says 14 March 2006 @ 17:38

Cheers Keith :-) There are a couple of folks that I know now that are really enjoying it.

Out of interest, how did you stumble accross my blog? :)

– JD

Keith says 15 March 2006 @ 12:06

I think I got it through the .net blog list thingy’ma’jiggy. ie. I’ve had your blog sitting there for ages :)

John-Daniel Trask says 15 March 2006 @ 12:07

Cool :-) So far that thing has been the best thing for my site for getting folks here :) Cheers for letting me know.

- JD

Leave a Comment

Name (required)

E-mail (required - not published)


Your comment: