The actual RottenPotatoes starter app you will use is in another public repo: UCCSCS3300/rottenpotatoes-rails-intro. Fork that repo to your own GitHub account, and then clone your fork:
$ git clone [email protected]:your_github_username/rottenpotatoes-rails-intro.git
Whenever you start working on a Rails project, the first thing you should do is to run Bundler, to make sure all the app's gems are installed. Switch to the app's root directory (presumably rottenpotatoes-rails-intro
) and run bundle install --without production
(you only need to specify --without production
the first time, as this setting will be remembered on future runs of Bundler for this project).
Finally, get the local database created:
$ rake db:migrate
Self Check Question: How does Rails decide where and how to create the development database? (Hint: check the db
and config
subdirectories)
Therake db:migrate
command creates a local development database (following the specifications inconfig/database.yml
) and runs the migrations indb/migrate
to create the app's schema. It also creates/updates the filedb/schema.rb
to reflect the latest database schema. Note: it's important to keep this file under version control.
Self Check Question: What tables got created by the migrations?
Themovies
table itself and the rails-internalschema_migrations
table that records which migrations have been run.
Now insert "seed data" into the database--initial data items that the app needs to run:
$ rake db:seed
Self Check Question: What seed data was inserted and where was it specified? (Hint: rake -T db:seed
explains the seed task; rake -T
explains other available Rake tasks)
A set of movie data which is specified in db/seeds.rb
At this point you should be able to run the app locally (rails server
) and navigating to http://localhost:3000/movies
in your browser. If you are using Codenvy, use the play button and navigate to the link generated within codenvy.