You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
Class methods (1) included (<= v2.3.8) Instance methods (14) attribute_change (<= v2.3.8) attribute_changed? (<= v2.3.8) attribute_was (<= v2.3.8) attribute_will_change! (<= v2.3.8) changed (<= v2.3.8) changed? (<= v2.3.8) changed_attributes (<= v2.3.8) changes (<= v2.3.8) field_changed? (<= v2.3.8) reload_with_dirty (<= v2.3.8) save_with_dirty (<= v2.3.8) save_with_dirty! (<= v2.3.8) update_with_
Introduction 第1章: for Ruby users (4) ・CRUD operations ・Assocations 第2章: for Rails users (15) ・With Scope ・Scoped Access 第3章: for Rails developers (17) ・Acts As View ・Finder Query CRUD : ActiveRecord Pattern require 'rubygems' require_gem 'activerecord' ActiveRecord::Base.eatablish_connection( :adapter=>"sqlite3", :db=>"db/users.db" ) class Member < ActiveRecord::Base # "members" e
● [Rails] with_scope (ActiveRecord) ActiveRecord::Base.with_scope(method_scoping = {}) {|| ...} with_scope はテーブル操作の範囲を限定するクラスメソッドです。指定されたブロックを実行する際、xxx_by_sql 以外のテーブル操作用のクラスメソッド全てが引数で指定された制限(影響)を受けます(※1)。 以下のような場面で効果を発揮します。 共通の値を持つ複数アイテムを簡単に初期化したい。 find(params[:id]) で取得したデータが不正アクセスかどうかの検証が面倒だ。 かと言って、find 時に :conditions 指定するのも面倒だ。 さらに、それをCRUD毎に指定するなんて気が遠くなる。 ※1:レシーバと同じクラスのみ影響を受けます。 ● スコープ指定 スコープの種類
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く