Vita Rara: A Life Uncommon

Ruby

Ruby Metaprogramming: Declaratively Adding Methods to a Class


Categories: |

In this brief piece I will examine Ruby's support for metaprogramming and how to define class level methods that add instance methods to our class implementations at run time.

Over the past few months I've been learning Ruby on Rails. One of the most attractive features of Rails its declarative style of defining relationships and validations on models; and filters on actions.

A simple example of this declarative style:

class Party < ActiveRecord::Base
  has_many :addresses
end

This class defines a Party model that can have many addresses. The simple "has_many :addresses" declaration is a great example of the power of Ruby. This simple statement adds a number of methods to our Party class, and allows us to easily manage relationships between our parties and their addresses.

2007: A Retrospective


Categories: | | | | |

Personal Life

Sylva and I got married on April 28. It's been a real whirl wind since then. We are expecting our first child on April 1, 2008. My time with Sylva is special and precious. I have a great partner, and look forward to raising a family together.

Overall business issues have dominated this year. I doubt that will be that case next year.

Business

It was a hard business year, but prospects for the future look good.

Quadran

Quadran has arrived. About 63,000 lines of Groovy, Java and JSP, with some XML files to wire it all together, and it's up and running. We turned on our first Quadran installation on December 5, 2007. This was the culmination of a process that began with an initial meeting in September of 2004, and the consummation of the development agreement in July of 2006.

Multi-Model Forms in Ruby on Rails


Categories: |

This isn't going to be an exhaustive tutorial on multi-model forms, but more of some observations from my learning to work with them over the past week. For a great introduction to multi-model forms see Railscasts. The major issue I've found if that the error messages when things go wrong, particularly at the view layer are almost meaningless or at worse utterly and totally misleading.

Syndicate content