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 |
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 MVCr stand for? | |
## 2) In what file do we store 'r' from MVCr ? | |
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 3 Quiz | |
## 1) What does ERB stand for? | |
## 2) What is the name of the place (library) where additional built in Ruby functions can be accessed? | |
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? | |
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 MVCr stand for? | |
Model View Controller Routes | |
## 2) In what file do we store 'r' from MVCr ? | |
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) Instance or class method? | |
A) User.where(:name => 'rich') | |
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. | |
a) Local (new = "foo") | |
b) Instance (@new = "foo") | |
c) Constant (NEW = "foo") | |
## 1) Where do SQL queries belong, the view or controller? |
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 is SQL Injection | |
## 2) Which of these are safe from SQL Injection attacks? | |
A) | |
User.where(:name => params[:name]) |
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) Instance or class method? | |
A) User.where(:name => 'rich') | |
Class Method | |
B) @user.favorite_movie |
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.9.3p194 :027 > Benchmark.measure {User.where(:name => 'richard').first.products}.real | |
=> 0.001004934310913086 | |
1.9.3p194 :028 > Benchmark.measure {Product.joins(:user).where(:users => {:name => 'richard'})}.real | |
=> 0.00015497207641601562 |