Skip to content

Instantly share code, notes, and snippets.

@seven1m
Created October 19, 2010 21:34
Show Gist options
  • Save seven1m/635169 to your computer and use it in GitHub Desktop.
Save seven1m/635169 to your computer and use it in GitHub Desktop.
class Person < ActiveRecord::Base
cattr_accessor :current_site_id
default_scope where(:site_id => Person.current_site_id)
end
Person.current_site_id = 1
Person.all
# => SELECT "people".* FROM "people" WHERE ("people"."site_id" IS NULL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment