Hal Spitz

Joined

830 Experience
8 Lessons Completed
0 Questions Solved

Activity

Chris,

Great video as usual. One question: when using custom environments, how do you handle Gem's that customize behavior based on Rails.env? For example: Rails.env.production? ? prod_thing : non_prod_thing

If we create a staging environment, that code will fallback to development behaviors.

Wouldn't it be simpler to have the devise pages opt out of Turbo via:

Posted in Direct File Uploads to S3: Part 3 Discussion

There is a subtle, but nasty bug in the video. Because of the way the form is created in the 'done' function, you create a form with a input type=file, which rails will attempt to process by uploading it and then discarding the data before it hits the controller.

If you are uploading a small picture, you might not even notice the extra work and delay, but I was uploading a 400Mb video, which Rails dutifully attempted to process -- adding over a minute of delay before the controller would respond.

The way I solved this problem (I would love to know if there was a better way) was to create a second form on the page that was hidden (this way, I get all the rails support for security and security tokens, etc.) and I used that second form to build up my data in the done function. This form DOES NOT have an input type=file -- it just has the shrine hidden field.