arel_or 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/arel_or/or.rb +7 -9
- data/lib/arel_or/version.rb +1 -1
- metadata +3 -3
data/lib/arel_or/or.rb
CHANGED
@@ -9,16 +9,14 @@ module Or
|
|
9
9
|
# for some reason, flatten is actually executing the scope
|
10
10
|
scopes = scopes[0] if scopes.size == 1
|
11
11
|
scopes.each do |s|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
rescue NoMethodError
|
16
|
-
# I am ActiveRecord::Base. Only my subclasses define merge_conditions:
|
17
|
-
where << subclasses.first.merge_conditions(s[:conditions])
|
12
|
+
w = []
|
13
|
+
s.where_clauses.each do |where_clause|
|
14
|
+
w << where_clause
|
18
15
|
end
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
where << w.join(" AND ")
|
17
|
+
|
18
|
+
joins << s.joins_values if s.joins_values.any?
|
19
|
+
includes << s.includes_values if s.includes_values.any?
|
22
20
|
end
|
23
21
|
scoped = self
|
24
22
|
scoped = scoped.includes(includes.uniq.flatten) unless includes.blank?
|
data/lib/arel_or/version.rb
CHANGED
metadata
CHANGED