meta_where 0.9.9 → 0.9.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.9
1
+ 0.9.9.2
@@ -20,8 +20,12 @@ module MetaWhere
20
20
 
21
21
  def args_for_predicate(value)
22
22
  case value
23
- when ActiveRecord::Associations::AssociationCollection, ActiveRecord::Relation
24
- value.to_a
23
+ when Array, ActiveRecord::Associations::AssociationCollection, ActiveRecord::Relation
24
+ value.to_a.map { |x|
25
+ x.respond_to?(:quoted_id) ? x.quoted_id : x
26
+ }
27
+ when ActiveRecord::Base
28
+ value.quoted_id
25
29
  else
26
30
  value
27
31
  end
@@ -29,7 +33,7 @@ module MetaWhere
29
33
 
30
34
  def method_from_value(value)
31
35
  case value
32
- when Array, Range, ActiveRecord::Associations::AssociationCollection, ActiveRecord::Relation
36
+ when Array, Range, ActiveRecord::Associations::AssociationCollection, ActiveRecord::Relation, Arel::Relation
33
37
  :in
34
38
  else
35
39
  :eq
data/meta_where.gemspec CHANGED
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{meta_where}
8
- s.version = "0.9.9"
8
+ s.version = "0.9.9.2"
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{2010-11-15}
12
+ s.date = %q{2010-11-17}
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
@@ -22,56 +22,54 @@ Gem::Specification.new do |s|
22
22
  s.email = %q{ernie@metautonomo.us}
23
23
  s.extra_rdoc_files = [
24
24
  "LICENSE",
25
- "README.rdoc"
25
+ "README.rdoc"
26
26
  ]
27
27
  s.files = [
28
28
  ".document",
29
- ".gitignore",
30
- ".gitmodules",
31
- "CHANGELOG",
32
- "Gemfile",
33
- "LICENSE",
34
- "README.rdoc",
35
- "Rakefile",
36
- "VERSION",
37
- "lib/core_ext/hash.rb",
38
- "lib/core_ext/symbol.rb",
39
- "lib/core_ext/symbol_operators.rb",
40
- "lib/meta_where.rb",
41
- "lib/meta_where/association_reflection.rb",
42
- "lib/meta_where/column.rb",
43
- "lib/meta_where/compound.rb",
44
- "lib/meta_where/condition.rb",
45
- "lib/meta_where/function.rb",
46
- "lib/meta_where/join_dependency.rb",
47
- "lib/meta_where/join_type.rb",
48
- "lib/meta_where/relation.rb",
49
- "lib/meta_where/utility.rb",
50
- "lib/meta_where/visitors/attribute.rb",
51
- "lib/meta_where/visitors/predicate.rb",
52
- "lib/meta_where/visitors/visitor.rb",
53
- "meta_where.gemspec",
54
- "test/fixtures/companies.yml",
55
- "test/fixtures/company.rb",
56
- "test/fixtures/data_type.rb",
57
- "test/fixtures/data_types.yml",
58
- "test/fixtures/developer.rb",
59
- "test/fixtures/developers.yml",
60
- "test/fixtures/developers_projects.yml",
61
- "test/fixtures/fixed_bid_project.rb",
62
- "test/fixtures/invalid_company.rb",
63
- "test/fixtures/invalid_developer.rb",
64
- "test/fixtures/note.rb",
65
- "test/fixtures/notes.yml",
66
- "test/fixtures/people.yml",
67
- "test/fixtures/person.rb",
68
- "test/fixtures/project.rb",
69
- "test/fixtures/projects.yml",
70
- "test/fixtures/schema.rb",
71
- "test/fixtures/time_and_materials_project.rb",
72
- "test/helper.rb",
73
- "test/test_base.rb",
74
- "test/test_relations.rb"
29
+ ".gitmodules",
30
+ "CHANGELOG",
31
+ "LICENSE",
32
+ "README.rdoc",
33
+ "Rakefile",
34
+ "VERSION",
35
+ "lib/core_ext/hash.rb",
36
+ "lib/core_ext/symbol.rb",
37
+ "lib/core_ext/symbol_operators.rb",
38
+ "lib/meta_where.rb",
39
+ "lib/meta_where/association_reflection.rb",
40
+ "lib/meta_where/column.rb",
41
+ "lib/meta_where/compound.rb",
42
+ "lib/meta_where/condition.rb",
43
+ "lib/meta_where/function.rb",
44
+ "lib/meta_where/join_dependency.rb",
45
+ "lib/meta_where/join_type.rb",
46
+ "lib/meta_where/relation.rb",
47
+ "lib/meta_where/utility.rb",
48
+ "lib/meta_where/visitors/attribute.rb",
49
+ "lib/meta_where/visitors/predicate.rb",
50
+ "lib/meta_where/visitors/visitor.rb",
51
+ "meta_where.gemspec",
52
+ "test/fixtures/companies.yml",
53
+ "test/fixtures/company.rb",
54
+ "test/fixtures/data_type.rb",
55
+ "test/fixtures/data_types.yml",
56
+ "test/fixtures/developer.rb",
57
+ "test/fixtures/developers.yml",
58
+ "test/fixtures/developers_projects.yml",
59
+ "test/fixtures/fixed_bid_project.rb",
60
+ "test/fixtures/invalid_company.rb",
61
+ "test/fixtures/invalid_developer.rb",
62
+ "test/fixtures/note.rb",
63
+ "test/fixtures/notes.yml",
64
+ "test/fixtures/people.yml",
65
+ "test/fixtures/person.rb",
66
+ "test/fixtures/project.rb",
67
+ "test/fixtures/projects.yml",
68
+ "test/fixtures/schema.rb",
69
+ "test/fixtures/time_and_materials_project.rb",
70
+ "test/helper.rb",
71
+ "test/test_base.rb",
72
+ "test/test_relations.rb"
75
73
  ]
76
74
  s.homepage = %q{http://metautonomo.us/projects/metawhere/}
77
75
  s.post_install_message = %q{
@@ -82,25 +80,24 @@ you're feeling especially appreciative. It'd help me justify this
82
80
  "open source" stuff to my lovely wife. :)
83
81
 
84
82
  }
85
- s.rdoc_options = ["--charset=UTF-8"]
86
83
  s.require_paths = ["lib"]
87
84
  s.rubygems_version = %q{1.3.7}
88
85
  s.summary = %q{ActiveRecord 3 query syntax on steroids.}
89
86
  s.test_files = [
90
87
  "test/fixtures/company.rb",
91
- "test/fixtures/data_type.rb",
92
- "test/fixtures/developer.rb",
93
- "test/fixtures/fixed_bid_project.rb",
94
- "test/fixtures/invalid_company.rb",
95
- "test/fixtures/invalid_developer.rb",
96
- "test/fixtures/note.rb",
97
- "test/fixtures/person.rb",
98
- "test/fixtures/project.rb",
99
- "test/fixtures/schema.rb",
100
- "test/fixtures/time_and_materials_project.rb",
101
- "test/helper.rb",
102
- "test/test_base.rb",
103
- "test/test_relations.rb"
88
+ "test/fixtures/data_type.rb",
89
+ "test/fixtures/developer.rb",
90
+ "test/fixtures/fixed_bid_project.rb",
91
+ "test/fixtures/invalid_company.rb",
92
+ "test/fixtures/invalid_developer.rb",
93
+ "test/fixtures/note.rb",
94
+ "test/fixtures/person.rb",
95
+ "test/fixtures/project.rb",
96
+ "test/fixtures/schema.rb",
97
+ "test/fixtures/time_and_materials_project.rb",
98
+ "test/helper.rb",
99
+ "test/test_base.rb",
100
+ "test/test_relations.rb"
104
101
  ]
105
102
 
106
103
  if s.respond_to? :specification_version then
@@ -303,4 +303,16 @@ class TestRelations < Test::Unit::TestCase
303
303
  end
304
304
  end
305
305
  end
306
+
307
+ context "A Developer relation" do
308
+ setup do
309
+ @r = Developer.scoped
310
+ end
311
+
312
+ should "allow a hash with another relation as a value" do
313
+ query = @r.where(:company_id => Company.where(:name.matches => '%i%'))
314
+ assert_match /IN \(1, 2, 3\)/, query.to_sql
315
+ assert_same_elements Developer.all, query.all
316
+ end
317
+ end
306
318
  end
metadata CHANGED
@@ -6,7 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 0
7
7
  - 9
8
8
  - 9
9
- version: 0.9.9
9
+ - 2
10
+ version: 0.9.9.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Ernie Miller
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-11-15 00:00:00 -05:00
18
+ date: 2010-11-17 00:00:00 -05:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -86,10 +87,8 @@ extra_rdoc_files:
86
87
  - README.rdoc
87
88
  files:
88
89
  - .document
89
- - .gitignore
90
90
  - .gitmodules
91
91
  - CHANGELOG
92
- - Gemfile
93
92
  - LICENSE
94
93
  - README.rdoc
95
94
  - Rakefile
@@ -142,8 +141,8 @@ post_install_message: "\n\
142
141
  walkthrough of MetaWhere's features, and click the donate button if\n\
143
142
  you're feeling especially appreciative. It'd help me justify this\n\
144
143
  \"open source\" stuff to my lovely wife. :)\n\n"
145
- rdoc_options:
146
- - --charset=UTF-8
144
+ rdoc_options: []
145
+
147
146
  require_paths:
148
147
  - lib
149
148
  required_ruby_version: !ruby/object:Gem::Requirement
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source :rubygems
2
-
3
- gemspec