DataMapper での One-To-Many-Through - daily dayflower の続き。 下記はあくまで説明のためのサンプル((まじめにアプリとしてインプリメントするなら,単に User や Mail モデルに削除フラグ(というか available フィールド?)を用意してそこを操作するだけにすると思う。))。 単純な One-To-Many (belongs_to と has n) の場合 require 'rubygems' require 'dm-core' require 'dm-aggregates' # Collection の count() 等をあとで使うため ### モデルの定義 class User include DataMapper::Resource property :id, Serial property :name, String