The If Works This dirt was a building before

Rails

Why Bayeux still matters

This article was prompted by a tweet from Micheil Smith: Why are people still using cometd when we’re seeing websockets come into most modern browsers? To recap, CometD is the reference client/server implementation of the Bayeux protocol, which defines a messaging protocol for web clients to publish and subscribe to message channels. This lets browsers [...]

Cross-process metaprogramming on the cheap

I will preface my first post of the new decade by saying: this is not by any means elegant. It’s an egregious hack, but it may come in handy for those of you using Culerity for testing your Rails front-end using JavaScript. This is not so much about JavaScript as about dealing with the multitude [...]

Getting started with Cucumber, RSpec, Webrat and multiruby

.cuke-pass { color: #4e9a06; } .cuke-fail { color: #d73734; } .cuke-pending { color: #c4a000; } .cuke-skipped { color: #06989a; } After a couple years off from full-time Ruby/Rails work, I’m getting back into it having just joined the development team at Songkick. Much as I’ve tried to keep my hand in with the Ruby world [...]

Consent updates: Rails 2.3 compatibility, request expressions every which way

A brief note to point out some changes I made to Consent, my access control DSL for Rails. I’ve been doing some Rails development for the first time in a few months and ran into some things that needed changing. First up, it seems Rails 2.3 uses application_controller.rb rather than application.rb for the root controller [...]

Consent: a little firewall DSL for your Rails app

Well, it’s been a couple of months. Rest assured I’ve still been hacking away; JS.Class will be getting hashes and constants at some point in the future, I’ve got a bunch of improvements to make on Bluff, and I’ve been contributing to PDoc which is a really promising JavaScript doc engine from Tobie Langel that [...]

Another super-tiny Rails plugin: classy_inputs

Good lord do I ever hate input tags. (YUI hates them too, but I’ll leave that story for another time). All the different types should really have been different tag names, and they are a total pain to use with CSS. As such, I used to end up doing tedious stuff like adding a :class [...]

Tiny Sunday coding project: has_password

Just a little announcement about something I cooked up this afternoon. It’s nothing ground-breaking but might save you a little time. Basically, I was getting super-tired of writing the same authentication code for every project so I extracted it into a plugin called has_password. Install like so: ruby script/plugin install git://github.com/jcoglan/has_password Now, this plugin is [...]

Quick and dirty icons in ActionView

Tiny tiny Rails tip: you can use method_missing to make using icon sets easier when writing Rails views. Behold: module ApplicationHelper def method_missing(sym, *args) super unless sym.to_s =~ /_icon$/ image_tag(“silk/#{sym.to_s.gsub(/_icon$/, ”)}.png”) end end Now the following call: <%= pencil_icon %> produces this image tag: <img src=”/images/silk/pencil.png” />

On-demand thumbnails with Rails and rmagick

My, it’s been a while since I wrote a Rails tutorial. I’m going to come back from the land of esoteric JavaScript techniques for a minute and talk about something you might actually want to use in real life. Many people, when writing an app that uses image uploads in some way, like to generate [...]

Let’s get committed

Right, I know I said I’d do this a long time ago, but I just got round to checking up on some of my Rails patches with the hopes of persuading one or two of you that they might be worth supporting and getting committed to the core. This post concerns a couple of patches [...]

← Before