General Tips1:25 with Jay McGavren
We want to leave you with a few general tips that aren't specific to Rails, but will help keep bugs from getting out of control.
We wanna leave you with a few general tips that aren't specific to Rails but 0:00 will help keep bugs from getting out of control. 0:03 First make sure you're writing automated tests or specs. 0:06 If you don't have tests you could accidentally make a change that 0:10 breaks a part of your app that was already working. 0:13 Worse it might be a long time before you find out about it, and 0:15 they'll be hard to fix later. 0:18 But if you have tests and they run them after you make changes, they'll fail and 0:20 let you know as soon as you break something. 0:24 Check the teacher's notes for more info. 0:26 Second, make your changes in small batches when you can, and test them frequently. 0:28 If you discover an error after you change five lines of code, 0:33 you may have to look at all five lines to find the problem. 0:36 If you discover an error after you change one line of code, 0:38 you know the error is on that one line. 0:41 Third, use a version control system like Git. 0:44 Version control lets you keep all the old versions of your files. 0:47 If you encounter an error and you just can't seem to find the source, 0:50 you can roll back to an old version of your code that doesn't have the error. 0:53 If you're not using version control, you might be stuck looking for 0:57 the problem for a long time. 1:00 If you'd like to learn more about version control, 1:01 make sure to check the teacher's notes. 1:03 Lastly, don't be afraid to use your editor's Find in Files feature to search 1:06 all the files in your project for a particular string. 1:10 Sure, it's a bit of a hack, but 1:13 sometimes it's the quickest way to find the line of code you need. 1:14 That's it for this workshop. 1:17 I hope you learned a few things that will give you more confidence next time you 1:19 encounter an error in a Rails app. 1:22 See you soon. 1:24
You need to sign up for Treehouse in order to download course files.Sign up