February 2012
1 post
Rails API Errors
Working on a mobile app? Want to show error field highlighting on signup? Do it the simple way:
unless @user.save
render json: {errors: @user.errors}, status: :bad_request and return
end
Wasn’t that easy?
January 2012
1 post
Rails Tensions
Yehuda Katz recently started a Twitter conversation about the burgeoning tension in Rails between standard html apps and API-based apps. Apparently some people are concerned that rails is superfluous, or at least awkward, when writing web APIs.
I think that Rails does a fine job serving up an API. There’s plenty of work to be done in the model and controller realms of MVC, all of which is...
July 2011
2 posts
Rails 3.1 Starting to Crystallize
The Rails 3.1 Hackfest is coming up, and at this stage in development there is a strong focus on ticketing all reproducible issues.
Could this mean that Rails 3.1 is finally approaching prime time? Hopefully we won’t see any tickets about modifying SafeBuffers, an issue that has already delayed the release.
Marketing Mysteries
These past few weeks we’ve been doing a soft launch of the new Gojee.com, and, among other things, that has meant that we’ve been hitting the streets trying to market the site to new users. This is a strong departure from the usual routine of an engineer, and it has offered some insights into a completely different type of work.
One of the first things that I realized about street...
June 2011
1 post
Forbidden Knowledge
One of the more provocative talks at this year’s Goruco conference was Sandi Metz’s talk Less -The Path to Better Design, which dealt with information-sharing and the Law of Demeter. The main point running through the talk was that each object’s knowledge of other objects should be as limited as possible in order to make the code more future-proof. It was a great talk, and it got...
May 2011
2 posts
Spin Doctors
A few weeks ago we had a problem: our feature tests would randomly fail about 2% of the time. Now, 98% might sound like a pretty good success rate for code that will never be touched by consumers, but for feature tests this is a horrible affliction.
Why do we even have feature tests? — to tell, unequivocally, whether or not the code is broken. Randomly failing tests, even if quite rare,...
To Kill a Mockingbird
RSPec stubs and mocks are a great idea, right? There are built in mechanisms for mocking the behavior of ActiveRecord models, so even the model/controller interaction can be easily isolated. Shouldn’t you always test code modules with the highest degree of isolation, so that code failures provide the most actionable information about what part of your system is at fault?
From my experience,...
February 2011
1 post
Plugins - The Double-Edged Sword of Rails...
Plugins are at once Rails’ greatest strength and most glaring weakness.
One of the most common problems with software development is the tendency to reinvent the wheel. A little bit of headache implementing a third party solution usually makes up for hours and hours of hacking together an imperfect solution to an already solved problem.
It’s also bad, however, to rely on hundreds,...
January 2011
1 post
The Case for Model Testing
Everyone loves Agile. Built from the ashes of the waterfall methodology, it solves so many of the problems that derail conventional development schemes. A well run agile project can add new features, react to changing requirements and fix bugs at a lighting pace. But this quick turnaround requires constant refactoring, which can potentially introduce bugs. The only solution is to obsessively test...