Week 8 Review

tags: [jason] [week 8]

Goals Review


Raising errors

One way to control execution flow in Workflows involves raising errors and rescueing it in the main run method. This pattern can be used when finding an object in active record since some of the find methods for example throw/raise an error when something isn’t found.

Rendering

I was defining local variables explicitly in the partials like a sucker!

ie, in a partial… drink_case = locals[:drink_case]

Instead, I could have called render with the partial: key value arg, as in:

render: partial: 'drink_cases/drink_case', locals { drink_case: @drink_case }

render can also be used to return partials for AJAX

# in a partial

...

  render json: { redirect_to: xxx_path }
else
  render json: { errors: { xxx.errors } }

Implementing MofoBottleO

Got a lot of the app going, and I might present the beginning of next week. Trying to work on understanding what is expected of me. I feel this pressure to pump out features, but I’m realizing that I need to work on learning best practices instead.

More: Code review Less: Rushed implementing

Deployment

Mick when over an interesting point with the production code, env variables need to be set for each server bc even if the code base is the same, things can break if you don’t set the environment variables correctly. This issue can be hard to spot if one didn’t know the architecture of the application.

This brought the conversation to understanding how different servers share state and what applications are run on different processes:

Time

ActiveSupport wraps db time with an object.