- Create a new Cloud9 instance with the "Blank" template
curl -fsSL c9setup.saasbook.info | bash --login && rvm use 2.3.0 --default
git clone [email protected]:it484-muzak/master-rater.git
- Change directory into the app directory
cd master-rater
gem install rails -v 4.2.6
bundle install
- Migrate the database:
rake db:migrate
- Seed the database:
rake db:seed
- Run the app:
rails s -p $PORT -b $IP
-
To delete all database data and rebuild it:
rake db:drop db:migrate db:seed
-
To manually query the ActiveRecords (i.e. Artists):
rails console
Artist.all
<- To see all ArtistsArtist.where("name = 'Defeater'")
<- To search for a specific record. Returns a list of results, even if there's only one.
-
Creating the route: Modifying the /config/routes.rb file: Example:
root 'pages#show
root
is the subdirectory to followpages
is the controllershow
is the action to perform
-
Creating a new controller for the route Running the following command will give us a new controller and .erb files for our route:
rails generate controller pages new create update edit destroy index show
rails generate controller
should stay unmodifiedpages
is the route name to create the controller fornew
specifies that we want to create a new controllercreate update edit destroy index show
are the actions our controller will have
-
Converting default controller generated .erb to .haml files
- Run the following rake command
rake haml:erb2haml
- Enter 'y' when prompted to remove the .erb files
- Run the following rake command