Sep 18, 2013

Coding on the Road

For the past four months I've been a digital nomad, traveling and working remotely from wherever I am. As a programmer, I'm grateful to do work that largely doesn't require a physical presence and for which bits traveling wirelessly earn me an income...

Continue →
Jan 13, 2013

My Goals as a Programmer for 2013

Though ultimately it's a date no different from any other - and entirely arbitrary - New Years Eve has always been a great time for me to reflect on what I'm doing with my life, and re-calibrate my goals. Though I have other "life goals" outside the...

Continue →
May 1, 2011
Rails Techniques

Using ActiveModel::Name to simplify URL generation

Most Rails developers are familiar with generating RESTful URLs polymorphically by simply passing an object to one of many helper methods that expects a URL, such as link_to and form_for:

# In Routes
                resources :articles
                
                # In View:
                form_for @article...
Continue →
Sep 2, 2010

Farewell Rochester, Hello San Diego

Six years ago I moved to Rochester, a city that at the time I had only vague recognition of, to start my life as a college student at RIT. In those past six years I've gotten to know and grown to like the city I began my "adult life" in, despite the...

Continue →
Jan 7, 2009
Rails General, Rails Techniques

Take Control of your Field Values with nilify_blanks

If in your data schema most or all of your fields are NULLable (the Rails default in migrations), you may have run into the issue whereby sometimes your fields are blank and sometimes they are NULL, two distinct representations of a "no data" state...

Continue →
Jan 3, 2009
Economics

The Economics of Supporting IE6

I recently had a discussion with a developer friend of mine concerning building web applications to support Internet Explorer 6 that highlighted a recurring theme of technology people misunderstanding business and economic decision-making. In it I...

Continue →
Dec 30, 2008
Rails Plugins, Rails Techniques

ActiveRecord Drafts with has_draft

I ran into a problem a while back of creating draft copies of ActiveRecord models for the purpose of establishing a draft/live system. I've since found a reason to resurrect this and publish it to GitHub and clean some things up. Check out has_draft...

Continue →
Jul 5, 2008

Inverting Permission-Based Filtering with named_scope

The addition of named_scope in Rails 2.1 has revealed several elegant approaches for modeling complex problem domains in ActiveRecord. One I came across recently while working on an app with a somewhat complex permissions system was a permission-based...

Continue →
Jun 25, 2008

named_scope with acts_as_tree

I fairly often use the acts_as_tree plugin in my applications. While acts_as_nested_set (and superior variants..) is more powerful, often times a simple two-level deep hierarchy is all I need and acts_as_tree is simple. I've found the new named_scope...

Continue →
Mar 19, 2008

JazzToolbox REST API Deployed

Today I deployed a major update to my Jazz object model which implements a full REST web interface that is currently accessible through a web browser. Visit http://www.jazztoolbox.com/ for the RDocs - there are plenty of examples at the bottom of the...

Continue →
Mar 11, 2008

Object-Oriented Approach to Blank Checking/Defaulting

Something I constantly find myself doing is checking to see if a value is blank, and returning something else if it is, otherwise the object itself:

birthday.blank? ? '0000-00-00' : birthday
                

I started thinking about how I could possibly eliminate...

Continue →
Feb 27, 2008

Introducing JazzToolbox: A computer model of Jazz Theory

As a (wanna-be) Jazz pianist, I've always had a strong interest in Jazz theory not only from a practical you-need-this-to-play standpoint but also a theoretical standpoint. At it's core, music theory is all about a 0 - 11 number system where each number...

Continue →
Feb 21, 2008

Create Structured Data in Migrations

Occasionally I'll decide to create some structured data in a migration by issuing create statements against my model classes. In a project I'm currently working on, I had to do this several levels deep. Rather than using temporary variables to create...

Continue →
Feb 7, 2008
Ruby Evangelism, Ruby Language

Overlap of Confidence with Static Typing

Since working with Ruby and other dynamic languages, I've thought a lot about the differences between statically-typed and dynamically-typed languages and what makes them different. Statically-typed languages guarantee some level of confidence of workability...

Continue →
Feb 2, 2008
Personal

New SliceHost VPS

Until now I've been running a my personal sites and a few other random sites I host on a dedicated box running CentOS 4 and Plesk. Last week I took the plunge for a SliceHost VPS and decided to configure everything myself and try to squeeze it all...

Continue →
Feb 2, 2008

Wrapping Conditional Access with with_scope

ActiveRecord::Base exposes a great way of keeping access control DRY. A very common paradigm in web application development is showing "all" of something to administrators but only only "active" of something to regular users/visitors. In non-ORM PHP...

Continue →
Jan 6, 2008
Book Reviews, Rails General

Book Review: Advanced Rails Recipes

I've owned the original "Rails Recipes" book by Chad Fowler for a while now and it's packed full of interesting information, but little of it I would consider "advanced". When I heard a new book by The Pragmatic Programmers called "Advanced Rails Recipes...

Continue →
Dec 20, 2007
Rails General, Rails Plugins, Rails Techniques

Nested URL Parameters

One of the great things about Rails is the ability to wire together form logic with extreme ease through Rails' support of essentially representing hashes through the "object[name]" syntax of URL parameters. Arrays are also supported in a similar manner...

Continue →
Dec 11, 2007
Rails General, Rails Techniques

User Alert Management with flash and ActiveRecord::Errors

A very common paradigm in web application development is presenting the user with some sort of alert or flash message at the top of a page. These alerts are often styled with a background and some sort of icon to the left to indicate what type of error...

Continue →
Dec 10, 2007
Rails General

Don't use symbols for route parameters!

I've ran into this issue more than once: Be sure that you are using strings and not symbols when specifying parameters for routes. Particularly, if you specify a symbol for :action, Rails will fail to see your controller action yet still show your...

Continue →
Dec 9, 2007
Rails General, Rails Techniques

HTML-Aware Truncate Text

When building a large custom PHP CMS system for DigitalPeach, I ran into a very difficult issue: truncating text but maintaining HTML nested tags correctly. Specifically, we were looking to breaking up large articles composed using FCKEditor into separate...

Continue →
Dec 7, 2007
Rails General

Rails 2.0 Released!

So today Rails 2.0 was finally released; it seems as though the Rails core team has been polishing this up for ages. I don't think there's a whole lot to get excited about. In short, Rails 2.0 gives you better opportunity to make use of best practices...

Continue →
Dec 2, 2007
Personal, Rails

Welcome!

I've been wanting to start a Ruby on Rails blog for a while to document my experiences using the framework and engage with the community, but always felt I wouldn't have enough time to maintain it. Today I decided to give in and begin RailsGarden.com...

Continue →