Creating an App on MathLAN

Once you have gotten Ruby and Rails updated in your home account on MathLAN, follow these instructions to create a new app.

You will want to create a directory that holds all of your Rails apps.  Hartl suggests creating one called “workspace” or “environment”.  Navigate into that directory.

Create a new rails app by typing: rails new <appname> -v <versionnumber>

You may get a warning about the version of sqlite3, which you should ignore for now.

Change directory into the new directory created by rails command.

Edit the Gemfile and delete everything.  Then copy and paste the Gemfile found in Hartl’s listing 1.5.  Be very sure that you have the correct code and that you get all of it!

Then, make some additions and changes to the Gemfile:

  1. add gem ‘bootsnap’ (do not add a version number)
  2. change the rails version to the version of rails you are using
  3. be sure that the sqlite version matches what is in Hartl’s example

Save the Gemfile and run the command bundle update. . If that completes without error, run the command bundle install –without production (NOTE: there are two dashes in front of production!)

Assuming that runs without error, you should be able to start the rails server with the command rails server -p 3001

If that does not give you any errors, you should see messages regarding the server starting.  It can take a few seconds.  When it is running, you will see a message to enter Ctrl-C to end, which is your cue that the server is running.

Open a browser and type in the address line: http://localhost:3001

This should display the happy “You’re on Rails!” image.

css.php
The views and opinions expressed on individual web pages are strictly those of their authors and are not official statements of Grinnell College. Copyright Statement.