acts_as_sourceable 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,10 +31,10 @@ module ActsAsSourceable
31
31
  scope :unsourced, where(options[:cache_column] => false)
32
32
  elsif options[:through]
33
33
  scope :sourced, joins(options[:through]).uniq
34
- scope :unsourced, joins("LEFT OUTER JOIN (#{sourced.to_sql}) sourced ON sourced.id = #{table_name}.id").where("sourced.id IS NULL")
34
+ scope :unsourced, where("#{table_name}.id NOT IN (#{sourced.select("#{table_name}.id").to_sql})")
35
35
  else
36
36
  scope :sourced, joins(:sourceable_registry_entries).uniq
37
- scope :unsourced, joins("LEFT OUTER JOIN (#{sourced.to_sql}) sourced ON sourced.id = #{table_name}.id").where("sourced.id IS NULL")
37
+ scope :unsourced, where("#{table_name}.id NOT IN (#{sourced.select("#{table_name}.id").to_sql})")
38
38
  end
39
39
 
40
40
  # Add a way of finding everything sourced by a particular set of records
@@ -98,7 +98,7 @@ module ActsAsSourceable
98
98
  if acts_as_sourceable_options[:cache_column]
99
99
  self[acts_as_sourceable_options[:cache_column]]
100
100
  else
101
- self.class.sourced.exists?(self)
101
+ self.class.sourced.uniq(false).exists?(self) # Remove the uniqness check because it allows for better use of the indexes
102
102
  end
103
103
  end
104
104
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_sourceable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-26 00:00:00.000000000 Z
13
+ date: 2013-02-09 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Allows the RRN to perform garbage collection on categories that are no
16
16
  longer referenced.