public
Description: Natural-looking Finder Queries for ActiveRecord
Homepage: http://www.thoughtbot.com/projects/squirrel
Clone URL: git://github.com/thoughtbot/squirrel.git
Switch to pseudo-alias_method_chain

git-svn-id: https://svn.thoughtbot.com/plugins/squirrel/trunk@303 
7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
jyurek (author)
Thu Feb 07 12:21:15 -0800 2008
commit  5e9f49d3e70d762681fc0b9d98e0418b2b777206
tree    f624552c903134b238bca78dfd46e62d80645c8d
parent  b9b56ed2ef413ff33d9fc14c1a871a37fa835f1b
...
5
6
7
8
9
 
10
11
12
13
14
15
 
16
17
 
 
18
19
20
...
5
6
7
 
 
8
9
10
11
12
13
 
14
15
16
17
18
19
20
21
0
@@ -5,16 +5,17 @@ module Thoughtbot
0
     module ActiveRecordHook # :nodoc:
0
       def self.included base
0
         class << base
0
- alias_method :pre_squirrel_find, :find
0
- def find *args, &blk
0
+ def find_with_squirrel *args, &blk
0
          args ||= [:all]
0
             if blk || (args.last.is_a?(Hash) && args.last.has_key?(:paginate))
0
               query = Query.new(self, &blk)
0
               query.execute(*args)
0
             else
0
- pre_squirrel_find(*args)
0
+ find_without_squirrel(*args)
0
             end
0
           end
0
+ alias_method :find_without_squirrel, :find
0
+ alias_method :find, :find_with_squirrel
0
         end
0
       end
0
     end

Comments

    No one has commented yet.