Created
July 9, 2012 21:45
-
-
Save schneems/3079202 to your computer and use it in GitHub Desktop.
Week 5 Quiz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Week 5 Quiz | |
## 0) Name 3 types of variables in Ruby? Put them in order from least scope to greatest. | |
## 1) Where do SQL queries belong, the view or controller? | |
## 2) Controllers are can do 4 types of operations what are they (RRFF)? | |
## 3) List the routes it usually take to fully implement CRUD in a web app: | |
## 4) What view typically holds a form that submits to the `create` action? | |
## 5) What view typically holds a form that submits to the `update` action? | |
## 6) If you forget what routes are available, what command can you run from the command line to help remember? | |
$ ____________ | |
## 7) Below is part of a route.rb file that would be mapped to the appropriate controller, replace this with one line of code. | |
get '/comments' | |
get '/comments/new' | |
get '/comments/:id/edit' | |
get '/comments/:id' | |
post '/comments' | |
delete '/comments/:id’ | |
put '/comments/:id' | |
## 8) Below is the code for a controller and a view, what controller action will be hit when you click on a link labeled "click me"? | |
app/controllers/courses_controller.rb | |
def index | |
@courses = Course.all | |
end | |
app/views/courses/index.html.erb | |
<h2>Courses</h2> | |
@courses.each do |course| | |
<%= link_to "click me", course %> | |
end | |
javogc
commented
Dec 18, 2014
- local, instance and class variables
- they belong to the controllers
- C(creat), R(read),U(update,D(destroy)
- #index
- new.html.erb
- edit.html.erb
- rake routes
- resource :comments
- The index
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment