14 Scopes Scoping allows you to specify commonly-used queries which can be referenced as method calls on the association objects or models. class User < ActiveRecord::Base scope :active, -> { where(status: 'active') } end
14 Scopes Scoping allows you to specify commonly-used queries which can be referenced as method calls on the association objects or models. class User < ActiveRecord::Base scope :active, -> { where(status: 'active') } end
5 Conditional Validation Sometimes it will make sense to validate an object only when a given predicate is satisfied. You can do that by using the :if and :unless options, which can take a symbol, a string, a Proc or an Array. You may use the :if option when you want to specify when the validation should happen. If you want to specify when the validation should not happen, then you may use the :un
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く