Installing Ruby on Rails on Win 7 Faffage by James Heywood

So I've been playing around with Ruby on Rails recently, well just today, anyway I wanted to see how easy it was to get a development environment set up, write a sample application and deploy this to the web somewhere.

This post is a step by step of the pain I went through getting this working on my Win 7 machine, and yes I know I'd be better doing this on Unix or a Mac, and I know Win 10 is just around the corner (although I suspect a lot of this will remain the same, it is still Windows!) but my current dev machine is rocking Win 7 so here we go;


  • A Win 7 machine with admin access
  • Git installed (msysgit) and working knowledge of this and the bash shell
  • A bitbucket account and experience working with these repos (or github, wevs)
  • Google-Fu > white belt, just in case!

Clean Install

First of all un-install and delete any previous ruby installs you may have lying around, I had 1.9, 2 and 2.2 for some reason - so let's lose those as we want a clean slate to start from.

Next, from stack overflow this article will get you ruby 1.9.3 and rails installed and working, I know it's not the latest version but I spent an evening Googling this to death and found that these steps worked for me so I'll start here with 1.9.3 and once happy with this I can always upgrade; 

  • Download Ruby 1.9.3 from  
  • Download DevKit file from - for Ruby 1.9.3 use DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe 
  • Extract DevKit to path C:\Ruby193\DevKit
  • Run the following commands;
    • $ cd C:\Ruby193\DevKit
    • $ ruby dk.rb init
    • $ ruby dk.rb review
    • $ ruby dk.rb install


Now you should be able to just new up a rails application, but I found that I had missing gem dependencies, starting with JSON.

To resolve this, you should be able to install JSON

  • $ gem install json --platform=ruby

Ok so now I should be able to new up a rails project, for example; 

$ rails new C:\dev\rails-example\rails-example

Mining for Gems

In reality I found I was still missing some gems, and successive attempts at creating a ruby project using the command above yielded the following suggestions, (1 at a time I might add, thanks ruby!);

  • gem install rake -v '10.4.2'
  • gem install mini_portile -v '0.6.2'
  • gem install nokogiri -v ''
  • gem install debug_inspector -v '0.0.2'
  • gem install binding_of_caller -v '0.7.2'
  • gem install coffee-script-source -v ''
  • gem install execjs -v '2.5.2'
  • gem install coffee-script -v '2.4.1'
  • gem install coffee-rails -v '4.1.0'
  • gem install columnize -v '0.9.0'
  • gem install debugger-linecache -v '1.2.0'
  • gem install debugger-ruby_core_source -v '1.3.8'
  • gem install debugger -v '1.6.8'
  • gem install multi_json -v '1.11.2'
  • gem install jbuilder -v '2.3.1'
  • gem install jquery-rails -v '4.0.4'
  • gem install rdoc -v '4.2.0'
  • gem install sass -v '3.4.16'
  • gem install tilt -v '1.4.1'
  • gem install sass-rails -v '5.0.3'
  • gem install sdoc -v '0.4.1'
  • gem install sqlite3 -v '1.3.10'
  • gem install turbolinks -v '2.5.3'
  • gem install tzinfo-data -v '1.2015.5'
  • gem install uglifier -v '2.7.1'
  • gem install web-console -v '2.2.1'

There has to be a better way to resolve this, and there probably is it's just that I haven't figured it out yet, this could be due to me using an older version of ruby, or I need to run another bundle command such as update? If and when I figure it out I'll update this post.

Start her up

Anyway, now we've resolved that, next we can start her up with the following command;

$ rails server

This boots the app and starts it on a specific port of localhost (3000 by default) so we can browse the out of the box default Rails site, finally!

Now What?


Well I guess I'd better find a tutorial to help me understand Rails a little, luckily there are loads of tuts on the web, I found this one

Following this tutorial I started a new rails app called hello_app

  • $ mkdir C:\dev\hello_app\
  • $ cd C:\dev\hello_app
  • $ rails new hello_app

This creates the rails app in a folder called hello_app, inside the folder I already created called hello_app, I suspect this may cause me an issue later but whatevs let's roll with this for now.

Next we need an IDE, I chose Aptana Studio 3 as its free and I'm a cheapskate; get it here: 

Once you open this up set your dev folder (in my case C:\dev) as the workspace, then navigate to your app folder and promote it to a project (from the right-click menu in the project explorer window of the IDE).

It looks like this creates you a .project file in your app folder, which presumably stores user/app settings etc, it also changes the icon on the app folder in the project explorer window of Aptana - fair enough, we'll check in this .project file to our repo as well then


Oh yeah, I set up a new repository in github for this, just to keep track of what I'm doing, you can see the repository here if you're interested;


The tutorial I followed recommended using Heroku to deploy my app too, to do this I first updated the Gemfile to include PostgreSQL (as Heroku uses this db), and this meant more gem dependency faffage. 

This time I was using the terminal window in Aptana, and between each gem install running bundle install to pick up the new gems and reinstall dependencies, which is what the 'rails new' command runs anyway, so the same issue/resolution but in my IDE within the sample project now, nicer but still rubbish; 

- gem install pg -v '0.17.1'
- gem install rails_serve_static_assets -v '0.0.4'
- gem install rails_stdout_logging -v '0.0.3'
- gem install rails_12factor -v '0.0.2'

New gems done, phew!

I could/should have used the command 'bundle install --without production' to prevent the need to install locally (but still update the lock file used on deploy to production), however I've done it now so have PostgreSQL and dependent gems installed locally and an updated lockfile ready for deploy to heroku (according to the tutorial, we'll see whappens on deploy!)

I've used Heroku before, but from my ubuntu machine, so we need the toolbelt installing here (my Win 7 machine) first, you can get that from here;

You may also need/want to update your version of git for windows (msysgit), Heroku toolbelt informed me my version was riddled with security issues (1.9.3) so I upgraded to the latest (1.9.5 at time of writing this) by getting it from here;

So run these commands (and add your info when prompted) to login, create and deploy to heroku:

$ heroku login
$ heroku create
$ git push heroku master

FYI what the 'heroku create' command does is add a second remote to your repository, which is heroku now instead of bitbucket (or Github if you're rolling with that). Deploying then is just a matter of pushing to the new 'heroku' remote, nice!

Heroku push rejected, WTF?

If you get any hassle from the push to Heroku then you probably haven't got your app in the root of your repository, which is the issue I found. This was due to my unneccesary nested folder structure that I mentioned earlier, yep that bit me. So ensure your rails app is at the root of your repository.

The error I got was; 

Heroku push rejected, no Cedar-supported app detected

Which is odd as the command '$ heroku create' created me a Cedar app (it detects this from your Gemfile I believe).

This stack overflow article helped me, specifically the 3rd answer about the rails app not being in the repo root;

Re-issuing the push to heroku now failed for a different reason, mainly that sqlite is not supported by heroku (they use postgres as mentioned earlier), so I had to do some re-jigging of my Gemfile to bring in line with the tutorial, the key part being that I moved the gem sqlite into the development and test group so it is only required in dev and test and not production. I also added the spring gem as the tutorial suggested I'd need this, as expected this resulted in yet more gem dependency chasing, as per below;

- gem install slop -v '3.6.0'
- gem install spring -v '1.1.3'

Ok so after moving my rails app up to the root of the repository, and after sorting out my Gemfile and chasing gems I was able to push to my heroku remote and deploy my sample rails app...

Except no, my defaut .gitignore file ignored my config/secrets.yml file - and this is needed by heroku, so I commented out that line in .gitignore, committed and re-pushed to heroku....

Et voila!

My new hello world rails app is up and running, you can see this magnificent beast here; 

For a real world app you probably don't want to retain your config/secrets.yml in a public repository - to get around this you could probably create a secondary private repo with the same heroku remote and contain the config/secrets.yml here, but then you'd have to pull in the latest from the public repo and merge this before pushing form the private repo to heroku, so a bit of faffage there. 

If anyone has experience of doing this please let me know in the comments if a) my suggestion above would work and b) you have a better solution to this. Cheers all.

So what have we achieved then?

  • Installation of Ruby and Rails on Windows 7
  • Setup of IDE
  • Sample Rails application created
  • Source control implemented
  • Simple deployment process set up and proven
  • Free basic hosting in Heroku for a Rails application

Not bad for an evenings work eh? Right that's enough blog for now, next I need to add some functionality to my shiny new rails app, catch you later folks.

TIL by James Heywood

So today (actually yesterday, but I didn't get round to posting until today and YIL just isn't a thing right?) was the penultimate day of the first sprint on our current project, (which I'll detail in a separate post at a later date) and as such was a busy day as we prepare for the end of sprint demo to the client. 

As has been the case a few times in my new role I was faced with a bit of a learning curve to get a piece of work done for the demo, briefly this was JavaScript based UI validation and integration with our .NET Web API, so not a new concept as such, however there is enough new technology in play to present a few challenges. On top of this the deadline of one afternoon to get the work done was a nice challenge, luckily I work best with a bit of pressure as long as there is support if/when needed, which thankfully there is.

Anyway, rather than bore on I wrote a list of the things I learnt today whilst doing my bit; 


  • how to install and use grunt
  • that grunt and live reload, via ruby and compass, makes for quicker development of JavaScript, and is < 100 lines of config to set up!
  • a little bit of coffeescript, and that I have a bit of a tech crush on coffeescript <swoon/>
  • that function returns are implicit in coffeescript syntax - I think we just had our first lover's tiff
  • that notepad++ screws your coffeescript outdents up (grrr!), but sublime text doesn't (yay!) +1 for sublime text
  • that all good things come to those who node
  • that fiddler is your friend, especially when working in JavaScript to hit end points in your API or Web project. Getting the request right and validating this in Fiddler means that you can concentrate on writing the best script knowing that you have your .ajax or .post requests correct, which is nice
  • that when sending Json objects from your JavaScript to Asp.Net API controller actions that bind Json to a model and then validate this model using (HttpActionResult.ModelState.IsValid), the properties of said model in .net may be name cased but Model.IsValid returns false unless you send up the properties in your anonymous JavaScript object camel cased! I think that this is due to our use of AutoMapper to map DTOs to Domain Models by convention, either that or it's the way we deserialize the Json to a .NET object using Newtonsoft.Json, both of which are excellent packages by the way.

So there you have it, a few little things for me to remember, posting this article should help in that respect. Also it's a good way to document the variety of technology used in my day to day role, I think it's fair to say I am a developer (technology agnostic) rather than a .NET developer, which has been the case for a while in both this and my last role, today just helps to remind me of that. 

One final thought, taking the time to list out, or just think about, what you learnt on a particularly busy day at work is a good way to boost your confidence in your own abilities, plus it helps to remind me that what I most enjoy is learning new things and that I'm glad to have a role that allows me to do that.

Right that's all folks, bye for now,