Topics Covered: introduction to rails
Note: All exercises must live inside of your session0202_exercises/firstname_lastname/d6
folder
While inside of your session0202_exercises
directory, you can git add .
then git commit -m "Helpful commit message here"
and git push origin master
to submit your homework to GitHub. (Don't forget to use git status
along the way to check the state of your files in git)
Complete the lab from class today! Try to write down questions as comments inline if any come up. Commit and push the lab to Github under your d6/blog
folder.
Create a file called answers.md
in your day6
folder to answer the following questions. Feel free to include images as well as text (Google how to do this in Markdown). Even if you're not sure about the answer, try your best! Feel free to write any lingering questions you have in the same file.
resources :sharks
in config/routes.rb
do?rake routes
do? Explain why you think this command might be useful.# app.rb
require 'sinatra'
get '/' do
erb :index
end
get '/heroes' do
@heroes = ["Batman", "Superman", "Rogue", "Wolverine"]
erb :heroes
end
get '/heroes/:hero' do
heroes = {
"Batman" => "batarang",
"Superman" => "strength",
"Rogue" => "flying",
"Wolverine" => "claws"
}
@hero = params[:hero]
@superpower = heroes[@hero]
erb :hero
end
Grab a partner, choose a topic we learned about today, and come up with a 60 second(ish) presentation worthy of the showing your fellow bru-sciples! We have some topics below for inspiration, but if you have a particular affinity to another topic, run it by Erica or Ian!
If you think have a solid handle on everything, build another rails app with 1 model, and see what you can do!