Archive for Rails

RailsconfEurope 2007

I’m a little late in mentioning this, but I recently spoke at RailsconfEurope about Rails Refactoring. It was a tutorial talk, and I thought that it went very well. I think the presentation is up on O’Reilly somewhere; I’ll link if I can find it.

Overall, the conference was really good. Berlin is an amazing city and the majority of the talks were really good. Of special note were the ones by Dr. Nic, Topfunky, and Evan Phoenix. Their talks about ruby magic, css generation, and rubinius were really well done.

Comments

Nyc.rb turns 3!

Well, last Tuesday nyc.rb turned three years old. Of course, we were not content with just turning three, so we decided to start taping our presentations also (By we, I mean me, because I have a video camera and turned it on). Francis gave a testing clinic, while yours truly gave a talk on refactoring. Both talks are available on Motionbox (the Rails video site at which I work) at this playlist.

To make things easier for you, I’ve also embeded the videos after the jump. Francis’s video is first with mine second. Sorry for the occasional fuzzy video quality, I’m still not good at filming presentations.

Read the rest of this entry »

Comments

CRUD Presentation

The slides from my CRUD Presentation to nyc.rb are now up. Lee Nussbaum snagged the audio, so I’ll sync that up over the next few days and post that too. If you’ve seen DHH’s presentation, this one is pretty much the same thing. In fact, many of the slides look fairly similar. I hope you don’t mind, DHH :-).

Comments (4)

How to Make Pound And SSL Play Nice With OS X

Though building sites with ssl is cool and gives your users a sense of security, configuring a webserver with ssl can be a royal pain. Thankfully, there’s pound. Pound is a “is a reverse proxy, load balancer and HTTPS front-end for Web server(s).”

Pound is dead simple to setup and configure. Unfortunately, the darwin port for pound is old and does not work. So this guide will help you build pound on your own. Besides, everyone feels cooler after compiling that hot fire. Click on for the steps.

    Read the rest of this entry »

Comments (5)

Use Session Sparingly (or The Benefits of Flash)

As tempting as it is to use it for everything, the rails session should be used sparingly. In reading through the code for my current project, I noticed that we are using the session for storing return urls and query strings when doing login redirects. This is bad.

Read the rest of this entry »

Comments

Ruby Reminder: Array Subtraction

Just a reminder when working with arrays of objects generated with Active Record.

[Model.find(1), Model.find(2), Model.find(3)] -
  [Model.find(1)] != [Model.find(2), Model.find(3)]

This does not behave as you would expect, because array subtraction compares elements on their object ids. Each find generates a new object, with a new id, so subtraction does not work. To get the behavior desired, do this instead:

to_be_removed = [Model.find(1)].map{|m| m.id}
[Model.find(1), Model.find(2), Model.find(3)].
  delete_if{|m| to_be_removed.include?(m.id)}

It’s not as beautiful, but it gets the job done.

Comments (1)