ちなみにモデルにはact as paranoid使ってdestroyは全て論理削除状態。
デフォルトのスコープでdeleted _at is nullの条件がつく状態。
1
User.where("created_at > ?",Date.yesterday).to_sql# => "SELECT `users`.* FROM `users` WHERE (users.deleted_at IS NULL) AND (created_at > '2012-03-08')"
user.images.where("").to_sql#=> "SELECT `user_images`.* FROM `user_images` WHERE (user_images.deleted_at IS NULL) AND (`user_images`.user_id = 1) ORDER BY position ASC, `sequence` ASC"