Commit 2847a806b531a61b68a09cdbbec7c1d9ed69e41c
1 parent
e55f5e28
Exists in
master
and in
11 other branches
Revert "No need for Rails 3 hack"
This reverts commit 6e051d949a92d5245414d20a96fbcf918570c7ba.
Showing
1 changed file
with
17 additions
and
0 deletions
Show diff stats
lib/groupdate/active_record.rb
... | ... | @@ -6,6 +6,23 @@ require "groupdate/series" |
6 | 6 | ActiveRecord::Base.send(:extend, Groupdate::Scopes) |
7 | 7 | |
8 | 8 | module ActiveRecord |
9 | + class Relation | |
10 | + if ActiveRecord::VERSION::MAJOR == 3 && ActiveRecord::VERSION::MINOR < 2 | |
11 | + | |
12 | + def method_missing_with_hack(method, *args, &block) | |
13 | + if Groupdate::METHODS.include?(method) | |
14 | + scoping { @klass.send(method, *args, &block) } | |
15 | + else | |
16 | + method_missing_without_hack(method, *args, &block) | |
17 | + end | |
18 | + end | |
19 | + alias_method_chain :method_missing, :hack | |
20 | + | |
21 | + end | |
22 | + end | |
23 | +end | |
24 | + | |
25 | +module ActiveRecord | |
9 | 26 | module Associations |
10 | 27 | class CollectionProxy |
11 | 28 | if ActiveRecord::VERSION::MAJOR == 3 | ... | ... |