pg_search 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,16 +1,22 @@
1
1
  = PgSearch
2
2
 
3
+ == 0.5.4
4
+
5
+ * Fix bug in associated_against join clause when search scope is chained after other scopes.
6
+
7
+ * Fix autoloading of PgSearch::VERSION constant.
8
+
3
9
  == 0.5.3
4
10
 
5
- * Prevent multiple attempts to create pg search document within a single transaction
11
+ * Prevent multiple attempts to create pg_search_document within a single transaction. (JT Archie & Trace Wax)
6
12
 
7
13
  == 0.5.2
8
14
 
9
- * Don't save twice if pg_search_document is missing on update
15
+ * Don't save twice if pg_search_document is missing on update.
10
16
 
11
17
  == 0.5.1
12
18
 
13
- * Add ability to override multisearch rebuild SQL
19
+ * Add ability to override multisearch rebuild SQL.
14
20
 
15
21
  == 0.5
16
22
 
data/lib/pg_search.rb CHANGED
@@ -11,7 +11,7 @@ module PgSearch
11
11
  autoload :Normalizer, "pg_search/normalizer"
12
12
  autoload :Scope, "pg_search/scope"
13
13
  autoload :ScopeOptions, "pg_search/scope_options"
14
- autoload :Version, "pg_search/version"
14
+ autoload :VERSION, "pg_search/version"
15
15
 
16
16
  extend ActiveSupport::Concern
17
17
 
@@ -41,7 +41,7 @@ module PgSearch
41
41
  end
42
42
 
43
43
  def relation(primary_key)
44
- @model.joins(@name).select("#{primary_key} AS id, #{selects}").group(primary_key)
44
+ @model.unscoped.joins(@name).select("#{primary_key} AS id, #{selects}").group(primary_key)
45
45
  end
46
46
  end
47
47
  end
@@ -1,3 +1,3 @@
1
1
  module PgSearch
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
@@ -116,6 +116,23 @@ describe PgSearch do
116
116
  results.map(&:title).should =~ included.map(&:title)
117
117
  results.should_not include(excluded)
118
118
  end
119
+
120
+ it "uses an unscoped relation of the assocated model" do
121
+ excluded = ModelWithHasMany.create!(:title => 'abcdef', :other_models => [
122
+ AssociatedModelWithHasMany.create!(:title => 'abcdef')
123
+ ])
124
+ included = [
125
+ ModelWithHasMany.create!(:title => 'abcdef', :other_models => [
126
+ AssociatedModelWithHasMany.create!(:title => 'foo'),
127
+ AssociatedModelWithHasMany.create!(:title => 'bar')
128
+ ])
129
+ ]
130
+
131
+ results = ModelWithHasMany.limit(1).order("id ASC").with_associated('foo bar')
132
+ results.map(&:title).should =~ included.map(&:title)
133
+ results.should_not include(excluded)
134
+ end
135
+
119
136
  end
120
137
 
121
138
  context "across multiple associations" do
@@ -356,13 +373,13 @@ describe PgSearch do
356
373
  excluded_associated_2 = AssociatedModel.create(:content => "baz bar")
357
374
 
358
375
  included = [
359
- ModelWithAssociation.create(:associated_models => [included_associated_1]),
360
- ModelWithAssociation.create(:associated_models => [included_associated_2, excluded_associated_1])
376
+ ModelWithAssociation.create(:associated_models => [included_associated_1]),
377
+ ModelWithAssociation.create(:associated_models => [included_associated_2, excluded_associated_1])
361
378
  ]
362
379
 
363
380
  excluded = [
364
- ModelWithAssociation.create(:associated_models => [excluded_associated_2]),
365
- ModelWithAssociation.create(:associated_models => [])
381
+ ModelWithAssociation.create(:associated_models => [excluded_associated_2]),
382
+ ModelWithAssociation.create(:associated_models => [])
366
383
  ]
367
384
 
368
385
  relation = AssociatedModel.search_content("foo")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-06 00:00:00.000000000 Z
12
+ date: 2012-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -114,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
114
  version: '0'
115
115
  segments:
116
116
  - 0
117
- hash: -999690345082589006
117
+ hash: 1787882256283338763
118
118
  required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  none: false
120
120
  requirements:
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  segments:
125
125
  - 0
126
- hash: -999690345082589006
126
+ hash: 1787882256283338763
127
127
  requirements: []
128
128
  rubyforge_project:
129
129
  rubygems_version: 1.8.24