nsturgis/Recipe-Box — pull request #1 by hchood (2014-09-02 15:33:10+00:00)
Title: Hh refactor

Hi Nick,

Nice job with the systems check!

I made some edits in this pull request, which you can see in more detail by clicking the "files changed" or "commits" tab. Here's a high-level summary:

**Use exec_params to avoid SQL injection.** For the `/recipes/:id` page, users could pass in nasty stuff like "5; DROP TABLE recipes;" as `params[:id]` and blow up your app unless you use `exec_params` to thwart their malicious intent.

**Use methods to query the database.** It's generally good practice to extract as much code as you can out of your `get` and `post` blocks into methods. Ideally, your `get` and `post` blocks merely create instance variables and render views, so they're like 2-3 lines.

**Indentation.** Make sure to follow conventions on indentation! The sooner you get used to indenting things properly the better. It'll become super important once we get to bigger apps and employers see sloppy indentation as a mark of inexperience/lack of professionalism.

Also, for the `/recipes` page, I'd probably use an unordered list rather than a table, since you're only listing one piece of information (the name) for each recipe, and designers tend to hate tables (though I'm not sure I could tell you why -- I think they just think they're ugly).

Good work. Let me know if you have any questions.

Helen