Skip to content

Instantly share code, notes, and snippets.

@jwashke
Last active April 22, 2016 15:39
Show Gist options
  • Save jwashke/36436f1d9e09272e1aac64920d05a31b to your computer and use it in GitHub Desktop.
Save jwashke/36436f1d9e09272e1aac64920d05a31b to your computer and use it in GitHub Desktop.

Week 5 Diagnostic

  • When and why would you rebase?
    • To clean up your commits and get rid of redundant or pointless commits
  • What are the steps to do a basic rebase via the command line?
    • git rebase -i which open atom(on my computer) then choose which commits to delete and which to leaved picked
  • Our cart in Little Shop is not stored in the database. How does its state persist across requests?
    • through an instance variable and session[:cart]
  • Name two objects used in Rails that can be used to track state of the user across requests.
    • sessions and cookies and the database
  • Draw the MVC model and the request response cycle through a rails app.
    • client: request -> routes -> controller -> model -> controller -> view -> response -> client
  • Give an example of something you'd use a Rails helper for.
    • In little shop we used a rails helper to pull out the logic determining if a button in the navbar was a login or logout link
  • How can we clean up duplicated code in the views?
    • partials
  • What type of variable is automatically available in a partial?
    • locals passed into the partial
  • If you want to use a local variable in a partial, what syntax is used?
    • render partial: "partial_name", locals: { variable_in_partial: variable_being_passed }
  • Describe the function and duties of the asset pipeline.
    • To precompile assets like Sass and Coffeescript, to concatenate your assets into single files for each type, and to minify them to save space
  • Give an example of an unacceptable use of a callback in Rails.
    • A callback that modifies a seperate model in the database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment