Slide 33
Slide 33 text
class ApplicationController < ActionController::Base
around_filter :ensure_merchant_consistency
def ensure_merchant_consistency(&block)
@merchant = Merchant.find_by!(:public_id => params["merchant_id"])
MerchantConsistencyCheck.with_merchant(@merchant, &block)
end
end
...
Customer.find_by_sql(["SELECT * FROM customers WHERE token = ?", "Paul"])
ScopedFindHook::ScopeError: Customer cannot return objects scoped by the
incorrect merchant. Got 6, expected 1.