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 - part 2.

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

We have previously set up a simple database, after installing ruby on rails and mysql, now to do something useful:

All commands need to be operated in a cmd window; a reminder for this is:

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

cd .. - takes you up a directory. (that is cd dot dot, do this twice to get to the C: drive

mkdir rubydev

cd rubydev

rails history

This command creates the history folder with a whole host of useful folders, files etc

rails history command results

cd history

ruby script/generate scaffold romford view

Scaffold Generator

Do  worry about the access denied error, this is because the database has not yet been configured properly. So, lets do this. Then run this command again, it still works without the extra files produced, but adds less scaffold code!

ruby script/generate scaffold romford view - the correct way

Using your normal view of a Windows file system, find the database.yml file, this exists in rubydev\history\config - and edit it in a text editor, I personally use textpad. Add the correct password in all three areas necessary.

OK, lets see if it runs -

ruby script/server

ruby script/server

It looks good, the server is running on port 3000, so we can try this out by accessing this at http://localhost:3000/  - it doesn't do much.

So, all this doesn't appear to done a lot, what else do we need, a controller appears to be the answer! Use Ctrl & C to stop the server running and try this command

ruby script/generate controller romford

ruby scrip/generate controller romford 

What happens if we start he server again, still not a lot

ruby script/server  & http://localhost:3000/romford

This does not even work properly now, until we make one tiny change in the romford_controller.rb - we add the line in red, save the file and refresh the browser window

class RomfordController < ApplicationController
    scaffold :romford
end

HEY PRESTO: Well, it's a basic design which did not take a lot of effort - see part 3

hey presto, we have a database web product from ruby on rails

 

More to follow - see part 3

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 10:26:42 PDT