It was a good day in the coding world of Seth. I started out completing a decent size lab in the ActiveRecord section. Then headed off to the Free Code Camp Nashville meetup. It was a great meetup where Jason Gresalfi presented on how he had created a Chrome extension. The repo for his extension can be found here and you can find it in the Chrome web store here. It’s amazing how “simple” chrome extensions can be. They’re just HTML, CSS, and JavaScript. Of course, you can build a backend to persist data in a database but you don’t have to. I think I’ll start looking for an itch I can scratch in that world so I have another project in the pipeline down the road. I think our group and meetup is starting to take more shape and we can make it something special in the Nashville community. Hopefully, we can organize and get some things we’re thinking about in motion here soon.
I almost finished ORMs and ActiveRecord tonight but I have one more video lecture to watch. There were 4 tonight which totaled over 4 hours so even on 2.0x it took a lot of time. I’m deciding to be in bed before midnight rather than finish the review. Maybe I’ll just fall asleep to the sound of Avi’s voice playing the video cast to my TV…? Actually, nope, not doing that.
I’m still struggling with understanding databases and how they relate without seeing a visual. However, ActiveRecord is making it A LOT easier to piece together. It’s bringing the database back into Ruby. From my notes tonight:
The model that
has_many
is considered the parent. The model thatbelongs_to
is considered the child. If you tell the child that it belongs to the parent, the parent won’t know about that relationship. If you tell the parent that a certain child object has been added to its collection, both the parent and the child will know about the association.
This is just good to know. It’s pretty self-explanatory I think. A really cool thing that Avi utilized in one of his lectures is Rails Erd. It takes the database tables and graphically shows how they are connected in a Rails app. I couldn’t get it to work as I’m not using Rails yet and I didn’t want to spend too much time messing with it but I’m definitely going to use it. If you’re interested it’s a pretty quick install and usage process:
brew install graphviz
Add gem "rails-erd"
to your Gemfile.
bundle install
rake erd
open erd.pdf
An example pulled directly from the repo:
According to my dashboard, I’m at 53 lessons for the week so I hit my goal of 49 with a day to spare! I’m super happy about this (although, sometimes I don’t trust the numbers on my dashboard…) and don’t plan on stopping now. We have an engagement (marriage, wedding, I can’t remember) part tomorrow at a winery so hopefully, I can still get a decent amount of coding in. Although, my shaggy mop is going to get a trim in the morning before we go so I might lose most of the day/afternoon/evening. I guess a social event a couple times a month helps to keep the sanity.
Time spent today: 7:08
Time spent total: 145:03
Lessons completed today: 9
Lessons completed total: 339