概要 原著者の許諾を得て翻訳・公開いたします。 英語記事: Ruby on Rails - make a if condition more simple with a scope 原文公開日: 2018/02/12 著者: Paweł Dąbrowsk 現在上記サイトは以下のlongliveruby.comに移行しており、元記事は参照できなくなっています。 Long Live Ruby – Ruby on Rails Web Development 2018/04/06: 初版公開 2023/01/27: 更新 シンプルなスコープを使ってif条件を簡単にできる状況はとてもよく見かけます。サンプルのクラスでやり方を説明します。 class User < ActiveRecord::Base has_many :posts end class NotificationService def