概要 原著者の許諾を得て翻訳・公開いたします。 英語記事: Say no to chained scopes! 原文公開日: 2015/06/24 著者: Jeroen Weeink サイト: Crafting Ruby 日本語タイトルは内容に即したものにしました。 2018/04/18: 初版公開 2023/02/14: 更新 Railsアプリで、次のようにモデルのデータベーススキーマの内部にまで立ち入っている(コントローラ)コードをよく見かけます。 class Person < ActiveRecord::Base enum gender: { male: 1, female: 2 } end class PeopleController < ApplicationController def index @people = Person.where(gender: Person.ge
![Rails: スコープをモデルの外でチェインするのはやめておけ(翻訳)|TechRacho by BPS株式会社](https://cdn-ak-scissors.b.st-hatena.com/image/square/069a9b7cdad8046fd24542118e2135850a09d730/height=288;version=1;width=512/https%3A%2F%2Ftechracho.bpsinc.jp%2Fwp-content%2Fuploads%2F2018%2F03%2Frails_say_no_to_chained_scopes_eyecatch-min.png)