arel_or 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
- s = s.proxy_options
13
- begin
14
- where << merge_conditions(s[:conditions])
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
- #where << merge_conditions(s[:conditions])
20
- joins << s[:joins] unless s[:joins].nil?
21
- includes << s[:include] unless s[:include].nil?
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?
@@ -1,3 +1,3 @@
1
1
  module ArelOr
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arel_or
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Phil Smy