Complete Exit Ticket: http://ix-exit-tickets.herokuapp.com/
Topics Covered: Model, View, Controllers
Note: All exercises must live inside of your s0203_exercises/firstname_lastname/d7
folder
While inside of your s0203_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)
Create a file called answers.md
in your day7
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
Pick 3 topics and write a short answer of what the topic is.
You hear about the recent shark attack? We want to keep tabs on all the sharks in the area so all iX students are safe. Let's create a Shark Watch app to help us keep track of sharks.
shark_watch
inside of your d7
folder with:Shark
, with attributes name
:string, size
:integer, gender
:string, and danger_level
:integer.sharks
with actions index
and show
index.html.erb
which shows all the names of the sharks with a link to each individual shark, and show.html.erb
, which displays all information pertaining to a specific shark.rails console
or seeds.rb
.