def referenced(name, model, reference = to_reference)
      define_method name do
        return nil if self.id.nil?
        @_memo[name] ||= begin
                           model = Ork::Utils.const(self.class, model)
                           model.find(:"#{reference}_id", self.id).first
                         end
      end
    end
def referenced(name, model, reference = to_reference)
      define_method name do
        return nil if self.id.nil?
        @_memo[name] ||= begin
                           model = Ork::Utils.const(self.class, model)
                           model.find(:"#{reference}_id", self.id).first
                         end
      end
    end
A macro for defining a method which basically does a find.

 Example:
   class Post
     include Ork::Document

     reference :user, :User
   end

   class User
     include Ork::Document

     referenced :post, :Post
   end

   # is the same as

   class User
     include Ork::Document

     def post
       Post.find(:user_id => self.id)
     end
   end