January 2008
10 posts
5 tags
To em, or to err.
There’s been some talk about ditching ems as the proper unit for measuring type in stylesheets. This is as many things are; while possible, probably not a great idea. Units allow us to speak on common ground. Almost everything has a unit of measure. For type, we use ems. so what’s an ‘em’? em: the square of a body of any size of type The argument for ditching ems suggests instead defining...
Jan 29th
6 tags
Using @url instance variable in rails
I was going into a project to do some general code refactoring (it’s a hobby, you know), and found some tests that we’re failing. Figured I’d fix those first and then bitch at whoever left failing tests in a project later. One test failure in particular looked a bit odd to me… 1) Error: test: The 'Add to Web' form should pass a URL into the form....
Jan 25th
5 tags
The SEED conference in chicago
Last week Chad and I flew out to windy Chicago for the SEED conference — “A One-Day Conference on Design, Entrepreneurship & Inspiration, by 37signals, Segura Inc. & Coudal Partners”. Both of our flights got in after 1AM, so we didn’t get to take in too much of Chicago Thursday night. We did have time to notice that the McCormick place convention center is pretty damn big though. ...
Jan 22nd
2 tags
no thanks
So I’m learning the latest Rails release by converting an existing app to it. This app used namespaced controllers for its admin section. New routes features have really cleaned this up. Before map.resources :users, :controller => 'admin/users', :name_prefix => 'admin_', :path_prefix => 'admin' After map.namespace(:admin) do |admin| admin.resources...
Jan 21st
Upcoming events
SEED Two of the thoughtbot founders, Chad Pytel and Matt Jankowski, will be at the SEED ‘08 conference in Chicago this Friday, January 18th. SEED is “a One-Day Conference on Design, Entrepreneurship & Inspiration”, with Jason Fried (37signals), Carlos Segura (Segura, Inc) and Jim Coudal (Coudal Partners) as speakers. acts_as_conference Chad, Matt, Dan, Jared, Joe, and I...
Jan 15th
2 tags
The defest of leppards
If you have any moderately old rails applications in production, and you find yourself screwing around with indexes in newer migrations, keep in mind that the index naming convention rails uses changed at some point (specifically, in changeset 4768). So if you had this in an application from a while ago – specifically, if you have an application that was in production prior to the 1.2 release...
Jan 14th
relax with your hacks
Good code has a rhythm. To me code with a good rhythm can be easily read and understood by any developer with a decent amount of experience in the language. What this usually means is avoiding hacks and tricks that you do to impress other developers with your amazing 5ki11z. Lets take a look at some Rails examples. From the Rails docs (I added the class..end block) class Post <...
Jan 14th
rails 2 point oh jesus
So I’ve been gradually getting my feet wet with the new Rails 2.0 release. Then I ran into the changes to ActionController::Resources#resource: A singular name is given to map.resource. The default controller name is still taken from the plural name. This means that if you have the following in your routes.rb ActionController::Routing::Routes.draw do |map| map.resource :session end Rails...
Jan 8th
not worth it
Behaviour-Driven Development. The latest fad thats been around for a while but seems to be picking up a lot more lately. I messed with it and blew it off a while ago but that was a while ago, so I decided to check it out again and see what all this malarkey is about. From behavior-driven.org It is not too surprising that it takes apprentice TDD practitioners a while to realize that TDD is not...
Jan 7th
designing without ifs
Alright here we go. Say we got an app with groups, users and memberships. Theres 2 different types of groups: Public Private Now anyone can join a public group but in order to join a private group we have to authenticate you against an external api. For example, say there’s a private group called ‘Yahoo’ and in order to join it you have to have a Yahoo account (yes this is...
Jan 2nd