Archive for the ‘Programming’ Category

Ruby’s beauty is often attrib­uted to its terse­ness. How­ever, there are times when you need to be really explicit in order to coax it to do your bid­ding. For exam­ple, a Rails form helper needs a bunch of paran­the­ses and curly braces in order to be a named ele­ment. Which makes sense, as :id can rep­re­sent a Rails (ActiveRe­cord) object ID or a DOM ele­ment ID. The Ruby punc­tu­a­tion removes such ambiguity.

(more…)

A typ­i­cal rails design pat­tern is to store object ids in ses­sion vari­ables rather than the objects them­selves. Objects can be unwieldy depend­ing on size, com­plex­ity, and asso­ci­a­tions. Ids on the the other hand are small, sleek, and more agile.

(more…)