def method_missing(sym, *args)
      method_name = sym.to_s
      debug "Base#method_missing: #{method_name}, #{attributes}"
      if m = /(.*)=$/.match(method_name)
        if args.size == 1
          val = args.shift
          attribute_name = m[1]
          write_value(attribute_name, val)
          debug "Base#method_missing (at end), write #{attribute_name} = #{val}"
          return
        end
      else
        if args.size == 0
          val = read_value(method_name)
          debug "Base#method_missing (at end), val = #{val}"
          return val
        end
      end

      super
    end
def method_missing(sym, *args)
      method_name = sym.to_s
      debug "Base#method_missing: #{method_name}, #{attributes}"
      if m = /(.*)=$/.match(method_name)
        if args.size == 1
          val = args.shift
          attribute_name = m[1]
          write_value(attribute_name, val)
          debug "Base#method_missing (at end), write #{attribute_name} = #{val}"
          return
        end
      else
        if args.size == 0
          val = read_value(method_name)
          debug "Base#method_missing (at end), val = #{val}"
          return val
        end
      end

      super
    end
FIXME: should we raise exception if attribute name is not association or defined column?
        currently don't keep track of valid columns per table