Fun With Association Proxies

Not only are tags great, they're a requirement of Web 2.0 (read the handbook). Here's a quick way to pull out those tags in a meaningful way:

class Post < ActiveRecord::Base
  has_many :taggings
  has_many :tags, :through => :taggings do
    def to_s
      self.map(&:name).join(', ')
    end
  end
end

Now, calling @post.tags.to_s will return the list of tag names separated by commas. The real magic is when you do this:

puts "#{@post.tags}"

Dot-Underscore Hell

A frustrating situation courtesy of OSX and mounted drives (over SMB in this case):

linux-host$ svn status
?      site/actions/._contact.php
M      site/actions/contact.php
?      site/conf/._controller-config.ini
?      site/conf/._nav-config.php
M      site/conf/nav-config.php
?      site/templates/._contact.php
M      site/templates/contact.php

Luckily, there's a command for that (OSX Leopard):

mac$ dot_clean .
linux-host$ svn status
M      site/actions/contact.php
M      site/conf/nav-config.php
M      site/templates/contact.php

See man dot_clean for more information. Credit to MacWorld for this tip.

Update: Since posting this, Brian pointed out that this is most likely a setting inside of TextMate. To disable, just run this command from a terminal:

defaults write com.macromates.textmate OakDocumentDisableFSMetaData 1

Do not run this using sudo if you want it to work (I found out the hard way).

Freezing Just a Single Gem

Sometimes you don't want them all frozen (maybe you want to build Hpricot on your target system instead):

  $ rake gems:unpack GEM=coderay
  (in /Users/preagan/Projects/sneaq)
  Unpacked gem: '/Users/preagan/Projects/sneaq/vendor/gems/coderay-0.7.4.215'

Hello, World

I'm pretty terrible with the whole blogging thing, so this is my attempt to bridge the gap between the verbosity of 140 characters and a full-fledged blog post. To make this whole thing easier, I wrote my own custom blogging software - we'll see how it goes...