AutoScope =========== Automatic add some named_scope before find, last, first and all. Example ======= Setting: ActiveRecord::AutoScope.configure do |c| c.attach(:company) c.attach(:department) end ActiveRecord::Schema.define(:version => 0) do create_table :people do |t| t.string :name t.string :company t.string :department t.timestamps end end class Person < ActiveRecord::Base auto_scope end And: Write named_scope 'company' and 'deparment' in somewhere (ex. plugin) Then: Person.find(:first, :conditions => {:name => 'alice'}) #=> Person.company.department.find(:first, :conditions => ... ) Copyright (c) 2009 Good-Day, Inc