Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Person < ActiveRecord::Base
- cattr_accessor :current_site_id
- default_scope lambda { where(:site_id => Person.current_site_id) }
- end
- Person.current_site_id = 1
- Person.all
- # => SELECT "people".* FROM "people" WHERE ("people"."site_id" = 1)
- Person.current_site_id = 2
- Person.all
- # => SELECT "people".* FROM "people" WHERE ("people"."site_id" = 2)
Add Comment
Please, Sign In to add comment