This should be old hat to anyone using ruby for a couple of months, but if you’re fairly new to ruby, and especially if you’ve been kinda, trying to keep afloat in ruby to grok rails, you might not yet know the following

You can assign multiple variables in one expresison in ruby, and as such chain together code to do some seriously cool stuff

Here’s a really simple example:

e = (Event.get_events_in_town t= Town.find(12)).first

This not only sets e to the first event, but also initialises t as that town’s event.

I’m not suggesting you write code like this by the way, but I found this so useful when using console, to debug my apps, or play around with my models