May 2007
11 posts
3 tags
Quirks of Assignment
If you’ve been using Ruby for any length of time, then you should know that you can override assignment on object attributes, right? It’s what you get from attr_accessor (by way of attr_writer), and it’s what you get when you define a something= method (which is what attr_writer really does).
>> class Foo
def bar= val
@bar = val
end
end
>> f = Foo.new
>>...
ruby on fails
So recently, I had a Rails app that raised the following exception: ActiveRecord::MultiparameterAssignmentErrors. This was raised in ActiveRecord::Base#initialize. It was caused by a model that had a date attribute. I was using ActionView::Helpers::DateHelper#date_select to get the value for a Job model’s expires_on attribute. Apparently a user had selected an invalid date, e.g. June 31,...
1 tag
Hackety Hack: A Growing Contingent
I’ve had the pleasure of being one of the original users/testers for Hackety Hack, a very substantial work released by why the lucky stiff. Hackety Hack is a learning environment for programming, targeted at kids but suitable for everyone.
_why made Hackety Hack not just to make learning coding easier, but to make it so easy that coding can become a mainstream skill, taught alongside math...
Highrise to LDAP Gateway
WARNING: Developed as a proof of concept in about 5 hours. Use with caution.
Adapted from the ldap-activerecord-server for its RailsConf 2007 presentation, this application will proxy your Highrise contacts as LDAP entries. Once you have this installed and running on a local server, you can point OS X’s Addressbook (or Outlook, Thunderbird, etc.) at it and get autocomplety goodness in your...
1 tag
New website and RailsConf update
We just brought live the new thoughtbot website (www.thoughtbot.com), which features an updated design and content. It also has our new logo and branding. Thanks to everyone involved in making the new site possible (you know who you are).
Also, we’re having a great time at RailsConf. Tammer is a rocker, he rocked out. The slides are available on our new website’s homepage.
A widget for your finger!
The transitions that thoughtbot has gone through over the last 12 months have been incredible. We’ve successfully transformed from a full service information technology consulting company to a web application development company, continued to build a team of great developers, and completed some truly fun and amazing projects for clients.
While we continue to do great client work, I’m happy to...
4 tags
Caulk or Ford?
Fellow RailsConf attendees, we invite you to weigh in on one of the key issues sure to face all of us as we complete our pilgrimages to the ruby mecca that is Portland.
When you get to the river – will you float your wagon on a raft, or will you attempt to ford across?
views gone wild
The pragmatic programmers dave and andy once summed up object oriented programming in 1 sentence: “Keep it DRY, keep it shy, and
tell the other guy.”
We all know DRY (mostly thanks to Rails now). We just discussed tell the other guy. But this time I want to touch on “keep it shy”.
Now “keep it shy” (a.k.a the law of demeter) is about coupling. An object is coupled to another object...
just scrap it
One problem with most of us developers is that we get too attached to our code. Whenever someone changes it in any way or criticizes it any way someone gets upset.
I used to be like this because like most of us, I thought my design was always the best design. As developers we need to lose our egos and be able to accept criticism. I don’t care if I spent 1 hour, 1 day or 1 month on a piece...
Presenting at RailsConf 2007
They’ve added a new track of sessions to RailsConf (‘Oregon Ballroom 204’ on the schedule), and mine has been chosen as one of them!
Taking Care of Rails Support Tasks Through Custom Daemons
Saturday, 19th, at 10:45 – room 204
Drop on by if you want to learn how to write your very own ruby daemon for fun and profit, and be sure to say hi when you do!
coding without ifs
The thing that complicates code more than anything else is conditional logic; ‘ifs’, ‘elses’, ‘unlesses’, nested and un-nested. I always try to eliminate them anyway I can because without them, the code is easier to understand and has a better rhythm. For instance:
def update_subscriptions Subscription.find(:all).each do |each| if each.expired? each.renew! else ...