The Archives


I’m Attending


Tag Archives: rails

Heroku, Rails 3, memcache and You

Posted in: Programming by Steve on October 29, 2010

Since Codemasher uses the CodeMash REST API, I didn’t want to bog it down with requests from the website. So I looked up how to use caching with Heroku.

Here is how I did it:

First, edit your Gemfile to include dalli as your cache client:

group :production do
  gem 'dalli'

Add this line to your environments/production.rb:

config.cache_store = :dalli_store

Finally, if you haven’t enabled the free 5MB memcache addon for Heroku, execute this from your application directory (command line/terminal):

heroku addons:add memcache:5mb
My First Real Rails App

Posted in: Programming by Steve on October 27, 2010

codemasher As CodeMash approaches, I wanted to build something that would get me more formally introduced to rails 3.  I also wanted to set it up so others could see it and view how I was coding it so I could get some direction.

So I present to you, the Codemasher. It’s a quick and dirty website that returns a random session to attend.  It uses the REST API provided from the CodeMash website and is the simplest site I could come up with.  I have deployed an example up on Heroku at

I hope to have it working where it remembers the sessions that you didn’t like. Another thing is to set it up to look at the sessions that will happen in the next chunk of time slot(s) so you could look at it at the end of a session and try to find another session to go to.

It was inspired by WTFSIMFD ( but without the curse words.

All of the code is available on github at  Please take a look and see how you like it, and if you would make improvements to it, I’m all ears.

Setting up a Linux Rails Development Virtual Machine

Posted in: Programming by Steve on October 26, 2010

I wanted to do some Rails development on my Windows machine, but I didn’t want to worry about compatibility.  So here are my steps to build up my development environment.

First thing is to download an Ubuntu VMWare Appliance.  I got my machine from

Second was to rename the machine – I used the tutorial here Since my server/network naming is based on characters from Futurama, I selected Leela as my rails development VM.

Next was to install git –, curl and the developer tools

sudo apt-get install git-core
sudo apt-get install curl
sudo apt-get install build-essential

Next, time to install the base ruby libraries:

sudo apt-get install irb libopenssl-ruby libreadline-ruby rdoc ri ruby ruby-dev

The next step is to install ruby gems and make sure that you have the latest version:

sudo apt-get install rubygems1.8
sudo gem update –system 

Now, you’re ready to start getting your environment setup for rails.  By default, new rails applications use SQLite3 so we’ll install it and get it ready for use in our applications if we so please.

sudo apt-get install libsqlite3-dev sqlite3 sqlite3-doc

Our next step is to install Ruby Version Manager. This package allows you to set specific versions of ruby (1.8.7 or 1.9.2 are the main versions) and set specific gemsets:

bash < <( curl )

Then open up your .bashrc file (located in the home directory, ~), and append the following code to the end of the file:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.

Now you can close your terminal session, open a new one, and RVM will be ready for you to use. 

There are a few editors that you can use (gEdit, Aptana Studio 3 or even JetBrains RubyMine which is a paid for application). I prefer TextMate on OS X so I use gEdit along with a few plugins to get it to look like TextMate.

That should get you started on your way to get developing on a linux VM, or even a regular PC set up with linux on it.


Using Other DOCTYPEs with HAML and Rails 3

Posted in: Programming by Steve on October 15, 2010

I recently purchased a site template from ThemeForest and I wanted to use it in a brand spankin’ new Rails 3 website.  I immediately created the application and installed haml.  I had heard so much about haml that I wanted to use it with this new site.  The DOCTYPE that the template used was 1.0 Transitional:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

However, by default, Rails 3 and haml render the default DOCTYPE as HTML5, like this:

!!! # => renders as <!DOCTYPE html>

Unfortunately, even if you try to add “!!! Transitional” as documented, it will not render the correct DOCTYPE.  So in order for me to get the correct doctype, I had to add a haml.rb configuration file under /config/initializers/ with the following code at the top of the file:

Haml::Template.options[:format] = :xhtml

So now, when the application is configured to use xhtml instead of the rails 3 default of html5, we will see the correct DOCTYPE. Took me a while to figure out why my template javascript and css wasn’t working properly.

Payments on your Rails Website

Posted in: Programming by Steve on September 15, 2010

One of the side projects that I’m working on uses Authorize.NET to accept payments.  I’ll be integrating it into a brand spanking new Rails 3 application.  Ryan Bates from Railscasts has a introduction to using ActiveMerchant that shows how to integrate PayPal payments (and a second as well). 

Here are some more resources on ActiveMerchant and Authorize.NET

Once I get a better handle on how to use cucumber and rspec, I hope to be able to post on how to TDD credit card transactions using ActiveMerchant

Windy City Rails – A Retrospective from an Outsider

Posted in: Programming by Steve on September 13, 2010

logo.pngI could go through each session and say what I learned, but I think going to these conferences should be more about the overall impression than about the nitty gritty details.  I wanted to meet as many people as possible and take in as much information as I could.

I got to meet a lot of great people like Scott Parker, Andy Maleh, Rachel Heaton, and Nick Lewis.  But the one thing I got from the conference is that the demand for Rails developers is growing, and growing fast.  All of the companies that were there (Groupon, Obtiva, Hashrocket, etc..) were hiring new talent, which is pretty amazing considering the economy.

My thoughts are confirmed by this article by the San Francisco Chronicle.

Thanks to Ray Hightower and ChicagoRuby for putting this all together.

If you want more of a play-by-play, Nick Gauthier has a great write up on his blog. Lots of photos here as well.

Quote of the Day: “So, your corporate culture sounds great … for bachelors” – Sara Trice in response to Hashrocket presentation on Team Building

Word of the Day: “Rehacktoring” – Jake Scruggs

Interesting Note: Apple was a sponsor of the conference



My First Rails Application

Posted in: Programming by Steve on April 2, 2010

After CodeMash, I decided it was time to see what the hubub was about with rails, so I picked up a Mac, a few books and a lot of beer.  The result is my first website built using rails and Heroku.  There’s not much to it right now other than my resume, but I’m looking at building a contact form as well.   So it’s not much of an application other than an HTML page rendered using rails, but at least it’s the start of something new.


Here’s to learning more in the coming months!