Daniel Hahn

Rails course in Paris - Documents

Here's some material for the Ruby on Rails course I gave at the University in Paris this week, on invitation of Prof. Fouquere. You can download the presentations slides (also the ones for the second day) if you like. There's also a git repository for the tutorial application that I built, and another one for the simpler tutorial application that the students created.

Quick Tutorial

To use Rails, you will have to have the Ruby programming language installed. You can either use the native version for your environment or JRuby. For Windows there's the one-click installer; JRuby should run everywhere, follow the instruction installations on their homepage. You will also need the "gems" program which is included in most systems, but an optional download for some Linuses (There was a git repository for the course, I deleted it because it was too large)

To follow through the tutorials, clone the git repositories and follow through. Each step is explained in the checkin message.

Once you have got Ruby installed, you should be able to just call


gem install rails

to download and install Rails. For further instructions follow the pointers on the Rails homepage.

Getting Started with your first rails App

To get started with your very first, very simple app you'll just need to do this (the commands in [brackets] may be needed for jruby users):


[jruby -S] rails my_first_app
cd my_first_app
[jruby] script/generate scaffold User name:string birthday:date
[jruby -S] rake db:migrate
[jruby] script/server

Your application will now be available at http://localhost:3000/users
(If you use JRuby, you may also need to install a Java database and configure the database through database.yml)

Pointers to what happened:

  • generators are used by Rails to create the templaes and files that are the starting point of your application
  • rake is a "make"-like program that you can use to run maintenance tasks from the command line
  • scripts are some Ruby programs/scripts that come with Ruby
  • migrations are define the schema of the "database". Migrating will create your database tables and fields

On the Ruby language

You can have a look at the introductory book (available online), or have a look at why's more anarchistic "poignant" guide. There's also a number of books available in print form

On Rails

Many resoures on Rails can be found through the home page, and there are tutorials and video instructions available on the web. It also pays to follow the Rails Edge blog and the Railscast if you want to stay up to date on new techniques. Mailing lists exist in almost any country or language, and are a good point to ask questions.

A good introduction is the book "Agile Web Development with Rails", and there are also others.

Other

If you've got any more questions you may also leave a comment her.

Article Image: http://www.flickr.com/photos/waldenpond/ / CC BY-SA 2.0

This project is maintained by averell23