meta_where 1.0.2 → 1.0.3

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.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ Changes since 1.0.2 (2011-02-09):
2
+ * Fix eager loading with order values supplied
3
+
1
4
  Changes since 1.0.1 (2011-01-18):
2
5
  * Fix *_all behavior to not result in ORs when collapse_wheres is called
3
6
  * Add support for NOT operator (-) on hashes, conditions, and compound
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.3
@@ -34,6 +34,7 @@ module MetaWhere
34
34
  end
35
35
  association.join_type = join_type
36
36
  @joins << association
37
+ cache_joined_association(association)
37
38
  end
38
39
  association
39
40
  else
data/meta_where.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{meta_where}
8
- s.version = "1.0.2"
8
+ s.version = "1.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ernie Miller"]
12
- s.date = %q{2011-02-09}
12
+ s.date = %q{2011-02-10}
13
13
  s.description = %q{
14
14
  MetaWhere offers the ability to call any Arel predicate methods
15
15
  (with a few convenient aliases) on your Model's attributes instead
@@ -345,10 +345,30 @@ class TestRelations < Test::Unit::TestCase
345
345
  @r.where(:name.matches => '%blah%').where(:name.matches => '%blah2%').to_sql
346
346
  end
347
347
 
348
- should "erge multiple conditions on the same column but different predicate with ANDs" do
348
+ should "merge multiple conditions on the same column but different predicate with ANDs" do
349
349
  assert_match /"developers"."name" = 'blah' AND "developers"."name" LIKE '%blah2%'/,
350
350
  @r.where(:name => 'blah').where(:name.matches => '%blah2%').to_sql
351
351
  end
352
+
353
+ context "with eager-loaded companies" do
354
+ setup do
355
+ @r = @r.includes(:company)
356
+ end
357
+
358
+ should "eager load companies" do
359
+ assert_equal true, @r.all.first.instance_variables.include?(:@company)
360
+ end
361
+ end
362
+
363
+ context "with eager-loaded companies and an order value" do
364
+ setup do
365
+ @r = @r.includes(:company).order(:companies => :name.asc)
366
+ end
367
+
368
+ should "eager load companies" do
369
+ assert_equal true, @r.all.first.instance_variables.include?(:@company)
370
+ end
371
+ end
352
372
  end
353
373
 
354
374
  context "A relation" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: meta_where
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.2
5
+ version: 1.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ernie Miller
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-09 00:00:00 -05:00
13
+ date: 2011-02-10 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency