Public Instance methods
row_proc()
If a row proc exists on the dataset, replace it with one that calls the previous row_proc
, but calls set_server on the output of that row_proc
, ensuring that objects retrieved by a specific shard know which shard they are tied to.
[show source]
# File lib/sequel/plugins/sharding.rb 110 def row_proc 111 rp = super 112 if rp 113 case server = db.pool.send(:pick_server, opts[:server]) 114 when nil, :default, :read_only 115 # nothing 116 else 117 old_rp = rp 118 rp = proc{|r| old_rp.call(r).set_server(server)} 119 end 120 end 121 rp 122 end