Jared McFarland

The musings of a 20-something engineer

Sprockets 2 With Rails 2.3

Update 06/26/2012 I changed the asset_tag_helper.rb and config/initializers/sprockets.rb file to be more robust and to support a “debug mode”.

Note: The sowftware I use to generate this blog (Jekyll) and the code syntax highlighter I’m using don’t support the #{} Ruby style string concatenation. In ALL the examples below, I’ve changed instances of "#{string_one}#{string_two}" to string_one + string_two This will have a few side effects, as Ruby automatically calls #to_s on objects when using the #{} style concatenation, but not the + style. If you run into issues, let me know.

At FutureAdvisor our main app is still in Rails 2.3, mainly because upgrading to Rails 3 is kind of a pain. I generally keep a few side projects around, like MyRoommate, to play around with new technologies. I’ve upgraded MyRoommate to use Rails 3.2 and am absolutely in love with the Asset Pipeline. So I set out to make it work with our Rails 2.3 app at FutureAdvisor.

Here’s what I’ll cover:

  1. Installing Sprockets and mounting the Rack app
  2. Overriding Rails AssetTagHelper to be aware of Sprockets specific pathing
  3. Precompiling assets for use in production (and Sprockets manifest files).

Serving a Static Website With Heroku

I recently wanted to setup a very simple static HTML site for a friend’s school project. I didn’t want to go through the hassle of setting up hosting, I just wanted to put it somewhere.

In the past I’ve used Heroku for this, but I’d never setup a static site there.

This is how I did it.

Full Stack Ruby on Rails Development for Snow Leopard

This blog is gonna talk about setting up Ruby, RubyGems, SVN, Git, Rails and MySQL for Snow Leopard. There’s a few other articles that go really in depth with setting up custom server configurations for Snow Leopard, but I found them to be doing more than I need for my personal development ( here ).

In order to get started you’ll have to have Snow Leopard installed, along with XCode (which includes X11). If you don’t install XCode you’ll get an error trying to install things with MacPorts.

Disclaimer: This setup worked for me twice, once on a MBP and once on a 27” iMac i5. I can’t guarantee it’ll work for you. If you run into issues, feel free to leave a comment, but I can’t promise I’ll know the answer.

I’ve setup two different Snow Leopard computers in the past couple days to do this, and I’ve compiled some notes on what worked for me.

Installing ImageMagick on SnowLeopard 10.6

Update: You can install it a lot easier by following these instructions.

When I installed Snow Leopard on my laptop I did a clean install, so my working environment on my laptop was totally wiped out. I had to reinstall ImageMagick the other day ( you can imagine my frustration when I was getting ImageMagick related errors thinking it was already installed properly). The installation was a bit tricky, so I figured I’d share it with ya’ll.

Here’s how I did it.