Git for Rails

Last night I ran a presentation on using Git, and very briefly how to start a rails project in git for the Brisbane Ruby & Rails Brigade

Mar 18 2008 08:17 | Tags: git rails | 25 comments

Snippets for Sass Bundle

I use Sass (& Haml), where its an option for producing sites, as I like the ‘cleanliness’ of it. I have been missing being able to use the snippets of the TextMate CSS bundle, so I have ported them over to a Sass bundle, with the syntax from http://sporkmonger.com/2007/12/24/sass-textmate-bundle.

I have published it at http://github.com/aussiegeek/ruby-sass-tmbundle/tree/from-css-bundle

Mar 23 2008 01:06 | Tags: git rails sass | 33 comments

mod_rails

I’ve just migrated the server that runs my blog, and some internal apps to mod_rails.

It is extremely simple to deploy compared to apache+mongrel like I was using previously, and more memory effecient for the seldom used apps I keep on this server.

I was warned of some potential gotchas in regards to rewrite rules, but no issues here, altough I am only using rewrites to redirect feed requests to FeedBurner.

My config for this virtual host in all its gory detail:


<VirtualHost *>
ServerName aussiegeek.net
DocumentRoot /srv/www/alanblog/current/public

RewriteEngine On

RewriteCond %{HTTP_USER_AGENT} !FeedBurner

RewriteRule ^/posts\.xml$ http://feeds.feedburner.com/alanharper [R=301,L]

Yes, thats all. Good work guys!
Apr 22 2008 10:42 | Tags: rails mod_rails feedburner | 25 comments

Haml/Sass talk at Brisbane.rb

I’ll be giving an intro to Haml & Sass at the Brisbane Ruby & Rails Brigage on monday night, if anybody is interested

May 14 2008 08:57 | Tags: rails haml sass brisbane-rb | 23 comments

Rails 2.1 migration

I’ve hacked together a simple script for converting timezones from the local timezone to utc for Rails 2.1

        #!env ruby
        class DummyTable
          def initialize(tablename)
            @@tablename=tablename
          end
          def self.method_missing(m, *args); end
          
          def self.datetime(name,options={})
            puts "execute \"UPDATE #{@@tablename} SET #{name}=CONVERT_TZ(#{name},'SYSTEM','+00:00');\""
          end
        end
        
        def create_table(tablename,options,*block)
          dummy_table=DummyTable.new(tablename)
          yield DummyTable
        end
        
        def add_index(name,fields,options={}); end
        
        class ActiveRecord;end
        
        class ActiveRecord::Schema
          def self.define(options={}, *block)
            yield
          end
        end
        
        require 'db/schema.rb'
        

Drop this file in the root of your project and just run it with plain Ruby. I wrote it this way so I could avoid ActiveRecord, it will spit out a bunch of execute commands ready for plugging in to a migration

Jun 17 2008 14:23 | Tags: rails timezone migration | 32 comments

Passenger support for Vlad

I’ve written a tiny module for Vlad to deploy to Passenger (mod_rails). It’s available from http://github.com/aussiegeek/vlad

To use it, just update your Rakefile where Vlad.load is called, and update it like so:

Vlad.load :app => 'phusion'

Jun 20 2008 08:42 | Tags: rails vlad passenger mod_rails | 30 comments

Error Handling

Lately, I have been trialing replacements for the ExceptionNotifier plugins, as getting spammed to death when something breaks is just not fun at all!

First of all at work, I have been running using Hoptoad, from Thoughtbot, which has been running fine

Dec 17 2008 07:55 | Tags: rails errors | 0 comments