Category Archives: Ruby
bob != the greatest
Fun bug. It’s not all that hard to see once you sort out what line it’s on, but when the sauce is much thicker… the initial Hash definition may not be the first place you check. …and when I say … Continue reading
Filed under Ruby
MySQL Triggers w/Rails
I recently incorporated db-triggers with a Rails app to maintain some counts that were otherwise fairly expensive to retrieve. Rails wasn’t super-pumped about the idea (what with the “keep all the logic in the app” approach and all), but sometimes… you … Continue reading
Filed under deployment, rails, Ruby, SQL, Test Driven Development (TDD)
Friend’s Price
A friend was asking the other day about getting a little site up and running for his small business. Seems like the scope is going to be quite small (famous last words) and there are a few things I’ve been … Continue reading
Filed under rails, Recommended Sites, Ruby
Baseball Draft
Ah yes, it’s that wonderful time of year again: fantasy baseball time. Anyone who plays fantasy sports can tell you that other than getting a check for winning your league (something I would know nothing about), the best part of … Continue reading
Filed under Ruby
Ruby String Concatenation
Ran in to a bug tonight. See it? def display_value display_value = notes.blank? ? “untitled” : notes display_value << ” (#{ shortcut })” unless shortcut.blank? display_value end Need a hint? The symptom was the +notes+ field being unexpectedly changed. +display_value+ … Continue reading
Rails Upgrade Bumps
After skimming the “What’s New” posts for several Rails versions without finding anything worth jumping at, it was time to upgrade. While JSON enhancements (fixes) are the driving reason for the move, there certainly are a few “nice to haves” … Continue reading
Leading zeroes on Time.strftime
Not sure why this isn’t in the Ruby documentation (at least where I normally check) but the common annoyance of leading zeros on Time.strftime can be avoided simply by using “%l”. It does come with another inconvenience though: you get … Continue reading
Filed under Ruby
Nice(r) Hash treatment for URLs
Isn’t it nice how Rails lets you add form elements using the convention: store[manager] = Bob Smith store[location][state] = Wisconsin store[location][zip] = 53590 And easily process them on the server side with something like: Store.new(params[:store]) So, why does this: link_to … Continue reading
Links for blackberry’s
A user recently reported an issue with our emails. The issue being that our links weren’t properly coming through on his Blackberry unit, while links from others looked fine. After a bit of digging the issue ended up being that: … Continue reading
Receiving Email with ActionMailer
This really was a snap. A nice and simple testing recipe (#68) demonstrates how to read in an email from a fixture in just a few lines and pass them to your processing method (MailReceiver.receive in this case). def read_fixture(action) … Continue reading
Filed under Email, rails, Ruby, Test Driven Development (TDD)