microtuts

Create a New Project With Rails 3.2

Things that might matter
Ruby: 1.9.3
Rails: 3.2
OS: MacOS X Snow Leopard

For this microtut I’m going to assume you have Ruby on Rails installed and now you want to create a project and get a start. Look a the previous post in the series if you haven’t installed Rails yet.

  1. Make sure you have Rails installed. Open the terminal and type:
    rails -v
  2. Open up the terminal and navigate to the directory where you want to keep your new Rails project. To create the project type:
    rails new railstest

    In this case “railstest” is the name of our project. You can call it whatever you want.

  3. You should now see a bunch of “create” statements as Rails sets up all the initial files your project will need. A folder named “railstest” should now exist. Congratulations. You did it. Have a pop-tart and relax a bit before moving on.
  4. Next, let’s run our project to make sure we’re on the right track. To do this we’ll use the built-in WEBrick server. This is a quick way to get up an running but eventually you would configure a proper development environment. To run your project just type:

    rails s

    You should see something similar to the following output:

    => Booting WEBrick
    => Rails 3.2.2 application starting in development on http://0.0.0.0:3000
    => Call with -d to detach
    => Ctrl-C to shutdown server
    [2012-04-13 11:11:19] INFO  WEBrick 1.3.1
    [2012-04-13 11:11:19] INFO  ruby 1.9.3 (2012-02-16) [x86_64-darwin10.8.0]
    [2012-04-13 11:11:19] INFO  WEBrick::HTTPServer#start: pid=55983 port=3000
    
  5. Pull up your projects start page by copying and pasting the URL from the output above into a browser. In this case mine is http://0.0.0.0:3000 but yours may vary.

    If all goes well you should see this page:

  6. Alright! You’re halfway to becoming a millionaire.

Creating your first programming language is easier than you think.

Understanding how a programming language works is a surefire way to be a better developer. Read more.


Suggested Reading


written by Ryan Bosinger
Ryan is a web developer living and working in Banff Alberta. He also writes for giftsforpeoplewitheverything.com and freefoley.com.

Leave a Reply