Rails Envy has a great screencast tutorial on ActiveRecord. Gregg does a great job explaining a couple concepts that can be difficult to grasp like has many :through and polymorphic relationships. This is well worth watching for anyone new to Ruby and Rails. Even if you are not working with Ruby, it is a good way to see how Object-relational Mapping is achieved in Ruby with ActiveRecord.

via Ruby Inside

About a year ago, my curiosity was piqued by Ruby on Rails. I picked up a copy of Agile Web Development with Rails and built a quick sample site. But, I realized that more than a cursory knowledge of Ruby would help move things along faster and make Rails development more enjoyable. Unfortunately, I did not have the spare time to devote to a new language, so I set it aside.

A couple weeks ago, I decided the time was right, so I got a copy of the essential Pick Axe book and started in earnest. What I found was an elegant language that lives up to the excitement that emanates from Ruby developers. The tutorials in the pick axe are adequate, enough to demonstrate the points the authors are making, but not very exciting. It is impossible to really learn a programming language with tutorials alone anyway. As with spoken language, the only way to become fluent is to use it.

My first two little exercises were little indeed. First, I wanted to run through this site and update all the self referring URLs to they were correct as there had been some URL changes over the years. This was really simple and only required hooking in to the database that runs the site and changing some URLs. This was all accomplished with ActiveRecord, some regular expressions and very few lines of code. The second exercise was to check the integrity of all the external links on this site. This was also trivial in Ruby. Most of the work with this exercise was in fixing the bad links which had nothing to do with Ruby. One would hope that a fair amount of the link fixing could be done programmatically but, unfortunately, that wasn’t what I found.

Now, I feel like I’m ready to dive back into Rails. I’m also happy to be using an elegant language that has a passionate community behind it. If you are contemplating the use of Ruby, I suggest trying one or two tasks with it. I doubt you’ll be disappointed.

Rather than enjoying a long awaited Spring Saturday in New York, I was at the first–and hopefully annual–Gotham Ruby Conference. Although the great weather was enticing, the conference was well worth the day spent indoors. The fact that it was at Google’s NYC office didn’t hurt.

The organizers of this conference deserve a huge, collective pat on the back for a job well done. This was one of the best organized events I’ve attended. No small task for a group of people that have day jobs and many extracurricular activities. Nice work all.

Here are my brief notes, for more detailed coverage of the talks, check out Bryan Helmkamp’s blog.

Adhearson: “Build your own PBX on a Weekend” (video)
Jay Phillips

Adhearsion is a Ruby layer on top of Asterisk. This talk got a lot of people in the room excited about the possibility of doing VoIP with Ruby. That’s good because Jay said he would like to hook up with some rails developers that are interested in Asterisk integration. This is very cool stuff. I personally would welcome one of the items off of Jay’s “future” slide: RSpec testing… for a PBX!

Resources:

JRuby: Ready for Prime Time (video)
Nick Sieger

JRuby is a version of Ruby that runs on the Java Virtual Machine. JRuby running in interpreted mode is still a bit slower than C Ruby. However, in compiled mode, it tends to run a bit faster in many cases. Release 0.9.9 should be available next week.

Going Camping (video)
Jeremy McAnally

Camping is a web microframework (4K) and in short, it’s “Rubylicious”. It is a MVC framework, but unlike rails, all of the application code goes in one file by default. Camping is good for those occasions when Rails is just too fat. Some other differences are that views are constructed in Markaby rather than ERb and Camping defaults to SQLite but using another RBDMS is certainly possible. Jeremy is working on porting some other very useful Rails modules to Camping.

Categorizing Documents in Ruby (video)
Paul Dix

This is a topic I am currently very interested in. Document categorization is used quite a bit for spam detection today. It is also quite useful for language identification, news categorization and sentiment detection.

At a very high level, the steps for machine categorization are as follows:

  • Get training data
  • Document preprocessing
  • Feature selection (optional, increases accuracy)
  • Train the Classifier
  • Test and update

Yes, that is very high level. Once again, get the details of the talk here.

For those wishing to get started with document categorization, Paul suggested the Naive Bayes Classifier since it is fast and forgiving. He said he would post has posted some of his categorization code on his site, including his Chi Squared feature selector.

Contexts, Mocks and Stubs. Oh My! (video)
Trotter Cashion

Trotter’s talk was very detailed and chock full of examples, my notes are quite sparse here though. The best thing I took away from it was to avoid going nuts when writing tests. Basically, test thoroughly and ensure good coverage, but be careful not to write too many tests or make them too brittle. Also, sometimes it is better to create a class for testing rather than to use mocks and stubs.

He also pointed out Ryan Davis’ Functional Test Matrix which looks quite interesting indeed.

Business Natural Language Ruby Systems (video)
Jay Fields

The idea behind Business Natural Language (BNL) is to put the power of changing business rules into the business expert’s hands rather than involving software developers for every change. Jay’s BNL site explains this much better than I can, so I won’t attempt to go into detail here.

One final note: Having the Lightning Talks directly after lunch was a great idea. It can be difficult to stay focused, or awake, during a long presentation after lunch. Short, five minute presentations by different people keep it lively.

Technorati tag: