Taking the Rails Train with Locomotive

Rails makes web application development tolerable. Locomotive trivializes setting up Rails on the Mac. Unfortunately, the best documentation on Locomotive is in screencast form on a contrary server.

So today I join the masses by bringing you my very own intro to Rails tutorial. Our “Hello World” application will be an editable todo list. Not quite Ta-da List, made by David’s company 37signals; but making ours will take twelve steps, six typed lines, and a hundred seconds or less.*

  1. Grab Locomotive.
  2. Open Locomotive.app.
  3. Choose: File >> New (Command+N).
  4. Type “todo” and hit return.
  5. Choose: File >> Open Terminal (Command+T)
  6. Edit db/schema.sql so it looks like:
    create table todos (
      id INTEGER PRIMARY KEY,
      todo VARCHAR(300));
  7. Type “sqlite db/mydb <db/schema.sql”.
  8. Edit config/database.yml to look like (indent using spaces or suffer the wrath of YAML):
    development:
      adapter: sqlite
      database: db/mydb
  9. Type “ruby script/generate scaffold Todo”.
  10. Go back to Locomotive and press the Run button.
  11. Point your browser at http://localhost:3001/todos/.
  12. Share and enjoy.
  • Time is measured from starting Locomotive. Milage may vary. Void where prohibited.

Join the conversation.

Comment Preview



Your comment will show up after it has been approved by site moderators.