Created
November 4, 2015 06:46
-
-
Save matt-stj/147afbdf1f773cc96a0e to your computer and use it in GitHub Desktop.
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
ActiveRecord | |
1.) What is the difference in using find vs find_by? Find takes 'id' as an argument and returns that record. Find_by can take any argument from the table and return the corresponding record. | |
2.) Why use where over find_by? Where will return multiple active record associations, while find_by will only return one. | |
3.) What does pluck do? Pluck returns an array of elements from a particular column. | |
4.) Describe joins. Joins pulls in information from multiple tables. | |
5.) Describe includes. Retrives all records that match a given query? | |
RSpec: | |
1.) What is the describe block for? Create an example group so you can nest sub tests within it. | |
2.) What is an it block for? For individual tests within the describe block. | |
3.) What is the difference between let(:thing), and let!(:thing)? The bang makes sure that :thing is created whether the method is called or not. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment