I’ve decided to merge http://charlesmaxwood.com with http://railscoach.com. The efforts on both sites seem to run in parallel with one site providing audio content in the podcast and the other providing content in test.
I feel like I can then focus all of the great stuff I’m doing on this one blog. This provides you a one stop shop and allows me to use this great layout created by Brandon Buttars.
Please feel free to give me feedback on this change.
Also, if you’re consuming the RSS feed, you may need to switch over to use the RailsCoach feed as I’m going to merge the feeds as well.
Not only can you find a single record by calling find_by_id, you can find multiple records by providing an array of ids.
User.find_by_id([1, 12, 55])
# Returns 3 User objects with ids of 1, 12, and 55. If any isn't found, then RecordNotFound is raised.
2. Locking database records
If you have multiple processes that may update the same record (like incrementing a counter), then you may run into a problem where they both pull the record when the counter = 42. They each update the counter to 43 and save the record. This results in a deviation from reality of 1.
I’ve been trying to read more code lately and figured that I’d be best served by reading code I use frequently. Here are some notes of things I gathered from reading the ActiveRecord base.rb file. [click to continue…]
Test Driven Development and Behavior Driven Development can be terrific tools in defining your code and ensuring the highest quailty software. In this episode, we discuss the differences between TDD and BDD and what the advantages are to doing them.
Loading multiple Ruby Gems can result in runtime errors when an incompatible version of a gem dependency is already loaded as a dependency of another gem.
Gem bundler can also pre-load and cache gems for faster loading.
Having two gems that require different versions of the same dependency can sometimes cause runtime errors. Yehuda Katz and Carl Lerche have created an elegant solution in the Gem Bundler. Download 108.8 MB Download (iphone & ipod) 48.8 MB