You are currently browsing the monthly archive for December, 2008.
2008 was a good year for me professionally. Here’s hoping that 2009 shapes up even better.
- Ubiquity 0.1.3 - Just out, the new version of the command line for Firefox. Like TextMate, this is one of those applications that I know I’m barely scratching the surface of.
- What good is a flexible paperclip? - Thoughtbot’s file attachment plugin is getting some overhaul.
- Espresso Public Beta - MacRabbit’s new web development environment. I need to find time to play with this, too.
- [ANN] Ruby 1.9.1 RC1 is released‘ - I’m responsible for this, you know: it happened minutes after I managed to get 1.9.1-pre2 installed.
- Learnivore! - Aggregation portal for Ruby and related screencasts.
I spent a lot of yesterday working on the Rails continuous integration story. Well, you know, it was shiny…
I spent a lot of yesterday deep in the Rails source, trying to figure out why some tests weren’t passing. No final conclusion but I think I’m on the right track.
Over the years, ActionController::Base#render has grown quite a few options:
render :action => "edit"
render :template => "products/show"
render :file => "/u/apps/other/warning.html"
render :nothing => true
render :inline => "<% @product.name %>"
render :update {|p| p.replace_html "A", "Error!"}
render :text => "OK"
render :json => @product
render :xml => @product
render :js => "alert('error!');"
Those options will still be in Rails 2.3, but the first three have a simpler alternative now:
render "edit" render "products/show" render "/u/apps/other/warning.html"
Rails will figure out whether you’re rendering an action, template, or file, and do the right thing. In addition, if you like symbols, you can render an action via a symbol:
render :edit
Last one of these before my tiny Christmas break.
Sometimes the fact that I don’t know all the ins and outs of Ruby, coupled with habits carried over from other languages, turns around to bite me. Here’s a console session demonstration of the latest problem I had:
>> a = b = 2 => 2 >> a = 3 => 3 >> b => 2 >> a = b = [] => [] >> a << 2 => [2] >> b => [2] >> a = []; b = [] => [] >> a << 2 => [2] >> b => []
So, trying to initialize multiple arrays and multiple integers doesn’t work the same. Live and learn.
Things may finally be slowing down for Christmas on the net, though not yet in my consulting practice.
Things may slow down a bit for the holidays…but for me, they’re still cooking right along.
QA and documentation are on my mind this morning. I need to remember the lesson that a PM can’t spend all their time coding.
Spent part of yesterday learning more than I really want to know about Apache logging. Perhaps I should raise our eldest to be a sysadmin.
Bumped my OS X up to the latest 10.5.6 yesterday…it was *mostly* smooth.
Off to a new week, packed with promise…and deadlines…
By now, you all know that you need to use attr_accessible to protect your application from having any old Active Record attribute changed by a malicious user. I find myself, in the course of consulting, looking at a great number of existing applications, and I’ve grown tired of having to open up every model and look. So, let’s be a bit smart: here’s a rake task that you can drop in any existing application to do the audit for you:
namespace :utility do
desc 'Find models that are not using attr_accessible'
task :audit_attr_accessible => :environment do
all_models = Dir.glob(
File.join(Rails.root, 'app', 'models', '*.rb')
).map{|path| path[/.+\/(.+).rb/,1] }
ar_models = all_models.select{|m|
m.classify.constantize < ActiveRecord::Base}
ar_models.each do |model|
model_class = model.classify.constantize
if model_class.send("attr_accessible").empty? &&
model_class.send("attr_protected").empty?
puts model_class.class_name +
" allows unprotected mass assignment"
end
end
end
end
(Hat tip Matt for the snippet to find all models).
Round numbers of these things always make me happy.
I’ve gone back to big pieces of paper (actually giant Post-It Notes) for ERDs. Feels very satisfying in the absence of acres of whiteboards.
Does anyone actually like end of the year bookkeeping?
It’s another new week, full of hope.
Or at least, bug trackers I have known lately, because I’ve used too darned many over the years. Someone recently asked me to summarize my experiences, and who can resist that kind of request?
If I were running a team of 10+ developers and choosing the tools, I’d start with FogBugz, which to my mind still does the best job I’ve seen of tying everything together and giving good predictive information. But I may be prejudiced, since they paid me to write a book
. I’ve used FogBugz on real-world projects and been quite happy with it, and for a medium-sized dev team I recommend it.
But these days, that’s not the sort of development team I’m usually a part of. Typically, I’m coming into a situation where a smaller team - 2 or 3 developers, 1 or 2 business folks - have already picked their tools, and I need to adapt. The collaboration software ranges from simple lists to full-blown project management tools. Here are some of the ones I’ve had to deal with in the past 2 years.
It may be heresy for me to say this, but I’ve never had an especially good experience with Basecamp. It tends to be too much overhead for a small team and to be too opinionated (in my never-humble opinion). Unless you’re making a commitment to it for multiple projects, it’s just too much bother to use, and too hard to customize.
Redmine is also not one of my favorites. Yes, it’s written in Rails, but other than that, I think it’s just behind the times. Entering a lot of data fields on a pure text interface doesn’t mesh well with the way I do business. If they add a really slick git integration I might take another look, but my overall feeling is that there are just better tools out there.
The venerable Trac is another one that I can find my way around when I need to, but can’t especially recommend. The integrated wiki is on the clunky side, and the whole system feels slow (that might be a consequence of the installations I’ve had access to, of course). I don’t like Trac’s reporting or workflow either.
No Kahuna has been excellent for small projects with clients who are less technically savvy. It offers an extremely simple interface, closer to a task manager than a bug tracker, but that’s what some people need. It supports multiple projects and tasks, and ranking things into buckets, and tracking who’s working on them. There are things I don’t like - such as multiple clicks to get back to the full task list after finishing a tasb - but this is one of the tools I end up recommending to people who just want collaborative tracking without a lot of fuss.
Hiveminder is another collaborative todo list that I’ve used on multiple projects. It’s got more bells and whistles than No Kahuna (and sometimes all the AJAXy stuff seems to slow it down), which makes it harder to learn to use effectively. I also find that its notion that you have a big bucket of “up for grabs” tasks doesn’t always play well with knowing who is responsible for what.
Lighthouse is another darling of the Rails world that I can take or leave. I like that it is low-ceremony, focusing on what needs to be done rather than on entering a bunch of excess data. I don’t so much like the navigation or searching, which seem confusing at times.
Pivotal Tracker I’ve just started using on one project, and I like it so far. The drag-and-drop UI makes the client happy because they can prioritize the work, and the simple tracking makes me happy because I can get it done. I don’t like the 0,1,2,3 scale for story points, and so far I don’t know how well its velocity tracking/prediction will work, but my initial impression is that this is one I’m going to hang on to.
Ever write code like this in Rails?
if File.exists?(File.join(RAILS_ROOT, 'config', 's3.yml')) has_attached_file :s3_image, :storage => :s3, :s3_credentials => File.join(RAILS_ROOT, 'config', 's3.yml') end
That particular snippet is from an application that optionally uses Amazon S3 to store images, if there is a configuration file for S3 supplied in the deployment. Well, you can clean that up a bit. First, although the RAILS_ROOT constant is still supported, we’ve had the prettier-looking Rails.root for months. Second, as of a recent commit to edge rails, Rails.root returns a Pathname object, so it directly supports the join method. Hence, the code snippet above can now be:
if File.exists?(Rails.root.join('config', 's3.yml'))
has_attached_file :s3_image,
:storage => :s3,
:s3_credentials => Rails.root.join('config', 's3.yml')
end
A tiny improvement, but of such tiny improvements are a pleasant framework made.
Has anyone seen my missing productivity?
Doesn’t feel like I have enough projects to justify the amount of busy I am. Not sure what that’s about.
Win some, lose some: good new client onboard yesterday, several older clients delinquent in their payments. The joy of freelancing.
Sometimes distributed team project management is very trying.
It’s now been roughly two years since I decided I’d had enough of Microsoft and went in search of greener (or at least less annoying) pastures. It seems a reasonable time to sum up how it’s been going again.
First off, it’s safe to say that I’m a Rails developer now. I dabbled in a few other things (and I’m always up for learning more), but for me, Rails has offered the right balance between pleasure of development and being able to find interesting work that puts food on the table. My hourly rate for Rails is still not what my hourly rate for .NET was, but I’m OK with that tradeoff.
With two years of Rails work under my belt, I’ve moved to the point where I’m starting to contribute to the framework. Perhaps not surprisingly to those who know my history, I’ve figured out that the best spot for me to contribute is on the documentation side (although I have had one code change accepted to core). I’m helping out with the docrails project (which is producing, among other things, the Rails Guides) and contributing the weekly “edge Rails” roundups for the Riding Rails weblog. I’ve also started writing for Rails Inside and Ruby Inside.
I also find myself playing Pied Piper and helping other people make the transition from .NET to Rails - including Dana Jones, who happens to be my wife as well as a designer and developer in her own right (so now we have two Rails developers in the office and yes, we are available for hire). I won’t say this is the career path for everyone, but it’s certainly worked for me.
All in all, I’m happy with where my career stands right now. Sure, we could be busier, and the hourly rates could be higher, but that’s always the case (and I have some other plans up my sleeve to help move in that direction). Overall, the increased happiness factor has made the transition more than worth it.
Somehow I survived November. Here’s hoping December will be less stressful.

