Homework for 17A

Review

Topics Covered: Payments with Stripe


The Daily Zack Shares Random Tips Show!

Be Part of the Show!

Over the course of each day, the TAs gain a lot of perspective on what topics you guys are a bit shaky on in your understanding. As well, we see certain issues that groups are individually running into again and again. So far, these have just been outlined in the exercises and discussed briefly, but we'd like your help in improving this process to optimize it's usefulness for future students. Please come talk to us if you have ideas about these points:

  1. Are there common issues that you would like to add to the list of tips that could have been discussed earlier to save you a lot of time?
  2. How we could most effectively get this information out to students?

And now for what you've all been waiting for:

  1. Type Sensitive Comparison. It'll get ya. An extremely common mistake is asking if "5" == 5 and expecting it to be true, however in RoR, comparison is type sensitive, so this will evaluate to false. This might seem obvious in this case, but a more subtle example is if params[:id] == 5. This will actually evaluate to false even if the params[:id] is 5, as the id from the params hash will always be a String, whereas 5 is a Fixnum.
  2. Don't leave a tab in Sublime without saving. Commonly we refresh and refresh a page in Chrome and wonder why it's not changing. After minutes of frustration, we realize that it's because we didn't save the file in Sublime! In order to save yourself time and embarrassment, always save a tab before you switch over to something else.
  3. Double quotes vs. single quotes. Despite the commonly held belief that these two options are exactly the same, there are some significant differences between them. First of all, using double quotes allows you to write single quotes in your string, and vice versa. But much more importantly, single quoted strings do not perform string interpolation! Sublime is your friend here, as any time you type '#' to start interpolating and Sublime doesn't give you '{}', it's warning you that you are not in an situation where interpolation is allowed (ERB with double quotes).