This is a small-but-functional URL Shortener. Your job is to make it more functional!
See the project wiki for details about what you should work on.
This project is meant to be an introduction to Rails "best practices" as well as an overview of the major moving parts of Rails. Take the time to look at all the various components, especially
- The routing file at
routes.rb
- The
Link
model atapp/models/link.rb
- The migrations in the
db/migrate
directory - The
Gemfile
- The RSpec tests in the
spec
directory
Note: In the commands below, $
represents your shell prompt, not part of the command to be executed.
-
Fork this repository into your own GitHub account
-
Clone your copy of the repository onto your local machine
-
Install the necessary Ruby gems by running
$ bundle install --without production
Note: We use
--without production
because the production environment (Heroku) requires the Ruby PostgreSQL gem (pg
). This gem can't be installed unless you're running your own local instance of PostgreSQL. -
Create a
database.yml
file by copying the example SQLite3 configuration file$ cp config/database.sqlite3.yml config/database.yml
Note: We've added
database.yml
to the.gitignore
file, which is standard practice. This is so that two developers with different local environments can have differentdatabase.yml
files without interfering with each other. -
Create an empty database by running
$ bundle exec rake db:setup
-
Create a
.env
file by copying the example file$ cp .env.example .env
Note: We've added
.env
to the.gitignore
file, which is standard practice. The.env
file is meant to contain environment-specific information, e.g., an API key belonging to a particular developer. In production, you'll useheroku set
andheroku config
to configure environment variables. -
Create the
config/secrets.yml
file, which contains the secret token used to cryptographically sign your application's sessions. Run:$ rake secret:create_file
-
Run the Rails application with
$ bundle exec rails server
-
Visit http://localhost:3000 in your browser.