History of Romford, Hornchurch, Barking and Havering, Rainham, Wennington, Warley etc & Lots of Historical Essex & London Pubs


powered by FreeFind

Ruby on Rails - an Idiots guide.

This is a working document, and I have added it to this site, as I tend to update mostly here.

I am a Computer Officer, at the University of Essex, where Ruby on Rails is taught as part of the curriculum, at a late stage in the undergraduate curriculum, and also at a higher level to the masters students.

This guide is to cover many of the simple, but [not always obvious] tips. I am NOT an expert, I just love trying out newer software, to ensure that I can help students out. But, also, as I run a few simple web sites, I thought I would give it a try in the real world.

Lunarpages.com whom host most of my sites, and also offer a brilliant support service, offer the use of Ruby on Rails as part of their basic package. You need to be on a server that actually supports the software, so a simple transfer is happening at present on one of my genealogy sites - essex1841.com . There is an excellent forum at Lunarpages too

So, here goes, what are the prerequisites to setting up, and running Ruby on Rails:

** To open a cmd window, go to. Start / Run and  type cmd and enter.

1. Get a copy of Ruby on Rails from http://rubyonrails.org/ - there are also some excellent tutorials here, too (better than this one!). Run the Windows installer,

1a Open  a cmd window and try runnning rails, i.e.  type rails. If it does not recognise the command - then you need to add rails.

1b Just type 'gem install rails' into the cmd window. This installs the rails stuff, what else is needed?

2. A copy of mysql is good, I do not like any other databases, except perhaps DB2 which is probably overkill. So visit http://dev.mysql.com/downloads/ and download an MSI installer for Windows MySQL 5.0, say  (unless you are a linux freak, then get one of those instead). I prefer Linux, too, but Windows is being used here.

3. If you do have a web site with a Ruby provider, ask them to organise the necessary changes, you need the fastcgi version of Ruby on Rails, and they will transfer your site onto a server that it works on.

4. Start learning, there are plenty of simple tutorials on the web, particularly at http://rubyonrails.org/ , but they cover only basic instructions. I purchased a couple of books, the first was from Wrox.com which was a very simple idiots guide, and expensive, and I am told that the author is very good at writing Idiots guides. Then, I tried 'Agile Web Development with Rails (Pragmatic Programmers)', a second hand book on Amazon, which cost me £10.15; and is worth its weight in gold. It is only the first edition, and is therefore a few years out of date already, but a brilliant read.

5. Today, as I am transferring my site to a server that supports Ruby on Rails, I needed to get into the coding properly. The second edition of 'Agile Web Development with Rails (Pragmatic Programmers)' is available as a pdf download at $23.50; and I have left the first edition at work, so within ten minutes I now have a copy of this too - cool.

6. So, next problem, maybe. I already have a set of databases, and tables, some of them quite large, e.g. (say) half a million records, these do not follow the Rails naming conventions. So, what should I do? Well, the obvious fix is to alter the tables,

7. Open a cmd window, i.e. Start / Run . type cmd

8 Type mysql  -u root -p

9 Enter password

10 type - show databases;

11 type - create database history_development;

12 type - quit or exit

To start, we need tables that have an 'id' column. most of mine do not, so I altered the structure. Create a database,

The first table I am going to work with lists the Romford 1841 census, table structure is:

CREATE TABLE IF NOT EXISTS `romfords` (
`id` int NOT NULL auto_increment,
`abode` varchar(36) default NULL,
`name` varchar(25) default NULL,
`surname` varchar(25) default NULL,
`agem` varchar(12) default NULL,
`agef` varchar(12) default NULL,
`trade` varchar(40) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Romford 1841 Census';

I used a plural for the table name, but I am not entirely clear if this is necessary.

13 Change directory to where you have this file saved, e.g. save as c:\db\romford.sql, then in the cmd window cd C:\db

14 Type - mysql -u root -p history_development < romford.sql

15 This says login to mysql, use the database history_development and input the commands in romford.sql

16 We now have a simple database set up, we now need to get ruby on rails running!

See part 2 


Search this site powered by FreeFind
I get hundreds of emails every day, fortunately most 'spam mails' are deleted by my mail scan settings. The final emails are delivered to various email addresses, and replying to these are not always successful. If you do not hear from me in a timely fashion, please feel free to email again, I do not mind! This is a pure PUBS history site, I doubt if I know where the PUBS are NOW, but try the site for where they were a hundred years ago, again enjoy!
Once you have discovered enough history of Essex; why not study to undergraduate or postgraduate level in Computer Science or Electronics Engineering at the Department of Computing and Electronic Systems, Essex University in Colchester, Essex? It is not only a great place to study, but also a foreleader in technology at an UK leading University with courses and doctoral research in Robotics, Natural Engineering, Intelligent Systems, Embedded Systems, Networking and Photonics, Laser Technology etc.
Updated in April 2008 by Kevan.
And Last updated on: Sunday, 27-May-2007 07:30:06 PDT