April 2008
9 posts
5 tags
Pitfalls in RESTful "wizards"
In an application we’re currently building, users go through a wizard to order teams. We implemented this as RESTful controllers – teams, purchases, and orders. The relevant wizard steps are: teams/new teams/:id/purchases/new orders/new When each step is submitted, the related create action is called and the user is redirected to the next new action. Pitfall: the user hits the...
Apr 25th
1 note
2 tags
not yet
Ok here’s an app as of right now. All the app consists of are some forms for creating users, some forms for users to create comments, plus 1 additional page that displays each user and the total # of comments they have created. There is NO page that displays a comment and its user who created it. The correct domain model based on the requirements right now is: class User <...
Apr 24th
mas o menos
Everyone seems to trip up when it comes to #< and #> and dates and times. def recent if published_on > 1.week.ago # blah end end def old if published_on < 1.week.ago # blah end end Nobody thinks of dates and times as numbers, so its hard to do comparisons on them quickly like you would with numbers. So lets add 2 methods to our dates and...
Apr 17th
11 tags
Moving to Github
We’re moving our plugins, gems, and other open source projects to github. I know, it’s a shock. We’re going to keep the SVN versions of them going for a while, but the “official” repositories for each of these is now what’s hosted on github. So get busy with the hot forking action. We’ve got: Jester Shoulda (and its gem) Paperclip Squirrel Quiet Backtrace MileMarker ...
Apr 15th
5 tags
The Emerging Standards Bureau
So I’ve been trying to enforce some halfway-arbitrary-but-plausibly-correct standards in my own code lately. Specifically, I’ve been looking at a certain class of helper method naming patterns we’ve been using for a while, and thinking about how to be most consistent across some different scenarios. I’m pretty sure that the pattern leading up to this decision is actually pretty well...
Apr 10th
7 tags
Conference videos
Couldn’t make it to Colorado or Scotland? There is full video available for a bunch of presentations from last week’s Mountain West ruby conf, including video of thoughtbot’s own Tammer Saleh, delivering his BDD with Shoulda talk (and sporting a handsome thoughtbot T). Tammer delivered a similar presentation this weekend at Scotland on rails in Edinburgh. Next scheduled stop is...
Apr 7th
3 tags
RESTful contact forms
Just like static content pages – simple “contact form” pages are another thing that can very easily fall into the RESTful pattern if you want them to. And, in the same way that seeing implicit actions in static page controllers keeps me up at night, so does seeing something like this in a controller… class SiteController < ApplicationController def contact if request.post? # Send...
Apr 4th
1 note
3 tags
Static pages for the enterprise
HasManyThroughJoshSusser writes about how to handle simple static pages. This is a fairly simple problem that many sites face. You want to keep use of your layout (and any conditionals in it – like a login/logout area, for example), but it feels like overkill to build a bunch of empty actions just to render static content. Not to mention that it’s a disgusting violation of RESTful...
Apr 2nd
uno o dos
Now in Ruby, strings can be created using single or double quotes. The only difference is that you can interpolate variables in double quoted strings. I constantly see the following confusing code: user.name = "name" link_to "home", root_path Here we’re using double quoted strings, but there’s no interpolation. As soon as I see double quotes, I think there’s going to be some...
Apr 1st