The If Works This dirt was a building before

Rails

PackR won’t touch your $supers

Another quick update: PackR received an update today that means that when you use its :shrink_vars mode, it won’t minify any variables called $super. In Prototype, $super is used to implement inheritance and your class definitions will break if you change its name. I didn’t really want to make PackR inconsistent with Dean’s original, but [...]

PackR gem now available

Update: the gem seems to be up on RubyForge now, so just gem install packr and you’re all set. At the request of Aman Gupta (again!) PackR is now available as a gem. I’ve not got myself all set up on RubyForge yet, but in the meantime you can download the gem from my subversion [...]

PackR, now with class methods

Quick note: at the suggestion of Aman Gupta, PackR now supports Packr.pack, Packr.minify and Packr.pack_file as class methods, so you don’t need to create an instance of PackR before doing anything. Originally, I wanted PackR’s design to mirror the JavaScript version to make maintainance easier, but these methods are a tiny addition so I’m happy [...]

Announcing PackR

I’ve no idea who may have done this already, but I certainly coundn’t find anyone who had in five minutes of searching. I’ve written a Ruby port of Dean Edwards’ Packer, and released it as a Rails plugin. It includes a rake task for batch-processing the scripts in your application. Install like so: ruby script/plugin [...]

Why freeze when you can symlink

Just a quick thought: for a while now, I’ve been putting this in my Capistrano recipe, in the :after_update_code task: run “cd #{release_path} && rake rails:freeze:edge TAG=rel_1-2-4″ But what’s the point in exporting the same 5Mb of files every time you deploy? Instead, let’s do this: run “ln -s #{release_path}/../../shared/rails/1.2.4 #{release_path}/vendor/rails” cd into your Capitrano [...]

LabelHelper is now part of Rails core

It’s official — as of changeset 7541, I’m a Rails Contributor. Hurrah! and so forth. LabelHelper, my plugin for DRY-ing up label tags in forms, is now in Rails core and will presumably be part of Rails 2.0 when it comes out. Now how’s about we get some of these committed as well? Oh, and [...]

String#toFunction for Prototype

As everybody is no doubt aware, there are new rules for getting a patch into Rails. With that in mind, I thought I’d share some of my patches here in the hopes that one of my army of readers (ha!) will find something I wrote interesting enough to try out for themselves. I’ve got a [...]

Mixing other languages into your Rails app for local development

For my current project, I thought it might be nice to offload a few Ajax calls onto something other than my app’s Ruby process – that can only handle one request at a time, and Ruby is notoriously slow, so I didn’t want to bog it down with some niche things that could take over [...]

How to fix bugs in software the hard way, or, why open source software is so damn helpful

If nothing else, this week has taught me a few things about bug fixing. As I’ve written about before, my IncludeByDefault plugin (or, more accurately, the project I’m using it for) exposed a bug or two in Rails. Revision 17 is the result of a very messy process trying to chase a bug up and [...]

IncludeByDefault progress

IncludeByDefault, as mentioned in my last post, hit some snags with ActiveRecord generating duplicate table aliases when doing cascaded includes, e.g. Tag.find(8).posts.find(:all, :include => :tags) So, I set out to work around it, only to run into further problems. I went with option C: let find operations get all the way to the database, and [...]

← Before After →