Ruby Ternary operator re-written with Boolean operators

Just noticed something interesting (well not that interesting). Ternary operators in Ruby can be re-written using Boolean operators e.g. method = object.respond_to?(:foo) ? :foo : :bar would become… method = object.respond_to?(:foo) && :foo || :bar Simply replace ? with && and : with || I don’t know if there is any performance gain here, anyone […]

Autotest Growl Fail/Pass Smilies

John Nunemaker posted a handy tip on “setting up autotest to work with Growl”: I use this all the time now however I didn’t like the ugly smilies (call me shallow if you like). I used “Wolfgang Bartelme’s”: “Smily Devkit”: to make a couple of PNG’s slightly more pleasing to the eye. p=. ! Fail […]

Rails Edge: Getting your view extensions ready for edge

Following my previous post, below is a modified version of “John Nunemaker’s ‘Renaming RHTML to ERB’”: to take into account the format in the extension, and handle “the RJS issues I was having”: namespace ‘views’ do desc ‘Renames all .rhtml views to .html.erb, .rjs to .js.rjs, .rxml to .xml.builder and .haml to .html.haml’ task ‘rename’ […]

Rails Edge: View file extention functionality has changed

It seems that on edge revision 6502 and later, the way that view file extensions has changed considerably. I couldn’t work out why my tests were breaking when doing an xhr request to a new action which had a respond_to block setup for both html and js. It was returning the html instead of the […]

Simply RESTful… "The missing action"

UPDATE 15/03/10: The debate continues… The ideas in this article came about whilst I was test-driving the Simply RESTful plugin following DHH’s RailsConf keynote on the subject. The philosophy The first thing I came across whilst experimenting with Simply RESTful (which is great by the way), was that there is no real way of deleting […]