Alan Peabody

Photo

Web Application Developer

Burlington, VT

New Year, New Domain, New Design, New Brand, New Goals, New Software

January 1st 2010

As we head into the new year and a new decade I decided it was time for some changes around here.

Domain/Branding Change

My old blog/domain was GAPDesigns.com, which frankly made no sense at all. Not only do I not run a design firm, I am not a designer.

I have owned AlanPeabody.com for a while, so this seemed the right time to start using it. In addition to representing that this is my personal blog better, it will also hopefully boost my Google presence. Specifically I am really hoping to have this blog be the number one result for searching Alan Peabody.

Posted In: Ruby, Rails, Blog, Design, Domain, Heroku, and TypeKit

Read the entire post >>

ActiveRecord _before_type_cast and validates_numericality_of

October 18th 2009

Just ran into this today, and did not find a documented solution out there.

Lets jump into some code write away.

The Setup


Class MyModel << ActiveRecord::Base

  # This attribute is not mapped from the database,
  # but we want to validate it...
  attr_accessor :temp_attribute

  validates_numericality_of :temp_attribute

  before_save :do_something_with_attribute

  def do_something_with_attribute
    # do whatcha gotta do, aight?
  end

end

The Problem

If you are on this post you probably got an error similar to: undefined method `temp_attribute_before_type_cast'

Posted In: Rails and ActiveRecord

Read the entire post >>

The State Of My Development Stack - Issue 1

October 7th 2009

Things change and move quickly in the Rails world. The technology you used 6 months ago is no longer the newest, shiniest toy in the box. Every 6 months or so I am going to start a journal of the technologies I am using and my thoughts on them. I hope it can provide a record for me to look back on and see how both the technology I use and my use and understanding of that technology has changed. I do try to stay current with the Rails world so I also hope this serves as a good representation of some of the current and popular technologies out there, with my own preferences of course.

Posted In: Ruby, Linux, Rails, TDD, BDD, and Development Stack

Read the entire post >>

Rails and PostgreSQL on Fedora 9

April 21st 2009

The recent Oracle-Sun acquisition on top of the mass exodus of MySQL developers from Sun has convienced my that my current project would benefit from a switch from MySQL to PostgreSQL. I was not to familiar with Postgres, so figuring out exactly how to install Postgres and migrate my Rails app to it was a little harder then it should have been. So, here is a quick and easy guide to Rails on Postgres and Fedora (9).

Posted In: Ruby, Rails, Fedora, and Postgres

Read the entire post >>

Using the jQuery history plugin with Rails

February 3rd 2009

On a recent project I was doing a lot of Ajax page loads for a "dashboard" type page. It was a case where I felt an Ajax approach was required. It was an internal project, so requiring JavaScript was not a problem.

However, I did have one major issue with the system. The back button was broken. This was a huge usability issue and needed to be resolved.

jQuery History Plugin

In the jQuery plugin index I found a history plugin that seemed promising, but was lacking much documentation. I also played with a few other plugins and found this one the best suited to my purpose.

Posted In: Rails, Ajax, jQuery, and History

Read the entire post >>

Rendering layouts with Ajax in a RESTful controller

November 17th 2008

In today's modern day web apps, the polish Ajax can provide is essential. However, you need to ensure that your application degrades nicely for those who don't have, or are not using, JavaScript; including some mobile users.

When requesting html from a scaffold generated REST action in a Rails app with an application layout you end up with a layout inside of a layout. Not what you wanted.

Posted In: Rails, Rest, Ajax, and jQuery

Read the entire post >>

RSpec, Autotest and libnotify on Fedora

September 25th 2008

There is a lot of stuff out there for using libnotify with your RSpec and autotest and Ubuntu, but not much for Fedora. Here is how I did it.

Install RSpec & Auto Test

RSpec instructions to install RSpec and RSpec-Rails as plugins.

Installing ZenTest is as easy as: (note the caps)


# gem install ZenTest

Now you should be able to get autotest running in the terminal. In yours rails project root directory:

Posted In: Rspec, Zentest, Fedora, libnotify, and Autotest

Read the entire post >>

Google Maps Gray Map of Death

September 19th 2008

For the last week I have been struggling with a perpetually gray Google map on a client site. I had worked with Google Maps API before and not encountered any thing like this. I could add and remove controls, change points, center the map etc. and not get a single JavaScript error.

But the kicker was that Firebug showed that all the images were down loading, I could even switch map types and get a whole new set of images.

Posted In: Google Maps and CSS

Read the entire post >>