public
Description: Natural-looking Finder Queries for ActiveRecord
Homepage: http://www.thoughtbot.com/projects/squirrel
Clone URL: git://github.com/thoughtbot/squirrel.git
squirrel / init.rb
100755 18 lines (15 sloc) 0.513 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require File.dirname(__FILE__) + '/lib/squirrel.rb'
class << ActiveRecord::Base
  include Squirrel::Hook
end
 
if defined?(ActiveRecord::NamedScope::Scope)
  class ActiveRecord::NamedScope::Scope
    include Squirrel::NamedScopeHook
  end
end
 
[ ActiveRecord::Associations::HasManyAssociation,
  ActiveRecord::Associations::HasAndBelongsToManyAssociation,
  ActiveRecord::Associations::HasManyThroughAssociation
].each do |association_class|
  association_class.send(:include, Squirrel::Hook)
end