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 +3 -0
- data/VERSION +1 -1
- data/lib/meta_where/join_dependency.rb +1 -0
- data/meta_where.gemspec +2 -2
- data/test/test_relations.rb +21 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.3
|
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.
|
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-
|
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
|
data/test/test_relations.rb
CHANGED
@@ -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 "
|
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.
|
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-
|
13
|
+
date: 2011-02-10 00:00:00 -05:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|