ä»æ§ãå¤ãããdefault_scopeã®å 容ãä¸æ¸ããããã«ãã§ã¤ã³ãããããã«ãªã£ãã 4.1ããå class User < ActiveRecord::Base default_scope { where state: 'pending' } scope :active, -> { where state: 'active' } scope :inactive, -> { where state: 'inactive' } end User.all # SELECT "users".* FROM "users" WHERE "users"."state" = 'pending' User.active # SELECT "users".* FROM "users" WHERE "users"."state" = 'active' User.where(state: 'inactiv
{{#tags}}- {{label}}
{{/tags}}