Created
June 25, 2012 19:54
-
-
Save schneems/2990855 to your computer and use it in GitHub Desktop.
Databases and Rails Recap Quiz for Week 3 [solution]
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
## 1) What does ERB stand for? | |
Embedded RuBy | |
## 2) What is the name of the place (library) where additional built in Ruby functions can be accessed? | |
STDlib | |
## 3) Name 3 Reasons to use Version Control. | |
- Ability to rollback | |
- Distributed backup | |
- Easily see diffs between commits | |
- Distributed work flow between team members | |
## 4) Name one version control software. | |
- GIT | |
- SVN | |
- Maven | |
- Perforce | |
## 5) What is the output of this Ruby code? | |
arry = ['Harry Potter', 'Hunger Games', 'Cat in the Hat'] | |
arry.each do |x| | |
puts "I enjoy reading #{x}" | |
end | |
"I enjoy reading Harry Potter" | |
"I enjoy reading Hunger Games" | |
"I enjoy reading Cat in the Hat" | |
## 6) What is the output of this ruby code? | |
richard = User.create(:name => 'richard', :movie => 'zoolander') | |
chris = User.create(:name => 'chris', :movie => 'sandlot') | |
ruby = User.create(:name => 'ruby', :movie => 'princess bride') | |
user_array = [richard, ruby, chris] | |
user_array.each do |user| | |
puts "#{user.name} loves watching #{user.movie}" | |
end | |
"richard loves watching zoolander" | |
"ruby loves watching princess bride" | |
"chris loves watching sandlot" | |
### Hint | |
puts chris.name | |
# => 'chris' | |
puts chris.movie | |
# => 'sandlot' | |
## 7) Once we've modified and saved a file that is under version control what 3 steps do we need to get our changes on to our origin server? | |
- add | |
- commit | |
- push | |
## 8) In the exercise we did for homework last week, you entered in a url similar to `http://localhost:8000/index` into your browser. Once the server got the request, explain what needed to happen in order for you to view the web page. | |
- The server receives the request, and reads in the url. | |
- Based on the path of the url ie `/me` it will look for a file named `me.html.erb` | |
- Our ruby server will read the contents of `me.html.erb` and then evaluate the ERB, the output is HTML that a computer can understand | |
- Rather than writing that output to disk, it sends it back to the browser that made the original request. | |
- The browser then renders the html |
In answer to question 4. Maven actually is not a version control software.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In question #8, does it look for a static me.html in the public folder before the me.html.erb in the views folder?