I’ve reached the 100-day mark. I have to say, I honestly thought I’d be done by now. I’m 82% of the way there. It’s going to be a mad dash to the end. I really, really, really don’t want to pay another full month’s tuition when I finish a few days into that billing cycle. So it’s pretty simple. I have to finish by June 27th. We’ll see what happens. I have a backup plan if I’m literally working on my final project and I’m sure I’m not going to make it. We’ll see if it comes to that or not…
Tonight had me learning about workers in Rails apps and specifically the Sidekiq gem. It’s pretty sweet how easily it can abstract out letting a task run in the background so a user can keep on with their work. The example in the lesson is loading a large CSV of leads into your web app. First, you create a worker file in
app/workers, make sure that file has
include Sidekiq::Worker, then take the long-running process and input that into
CSV.foreach(leads_file, headers: true) do |lead|
Customer.create(email: lead, first_name: lead, last_name: lead)
After that replace the long-running process code in your controller by running the worker.
class CustomersController < ApplicationController
@customers = Customer.all
Now if you upload a large CSV file via the form at
/customers, when you submit it everything will move along. Then as you refresh the index page
/customers it will have a growing list until the CSV file is done being imported into the DB.
I also did a few lessons on Consuming APIs. Luckily for me, this is not completely new to me so I have a good base to work off of. Actually, this shouldn’t be completely new to anyone in the program as earlier labs deal with pulling API data and rendering it to the DOM. My main note on APIs is the querystring which trips me up sometimes.
? after the URL
Although, I also learned how Postman has a params section with key/value pairs which helps with building out the query string.
Time spent today: 1:53
Time spent total: 369:58
Lessons completed today: 7
Lessons completed total: 621