squeel 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
data/lib/squeel/version.rb
CHANGED
@@ -253,7 +253,13 @@ module Squeel
|
|
253
253
|
when Nodes::KeyPath
|
254
254
|
accept(k % quote_for_node(k.endpoint, v), parent)
|
255
255
|
else
|
256
|
-
|
256
|
+
attr_name = k.to_s
|
257
|
+
attribute = if attr_name.include?('.')
|
258
|
+
table_name, attr_name = attr_name.split(/\./, 2)
|
259
|
+
Arel::Table.new(table_name.to_sym, :engine => engine)[attr_name.to_sym]
|
260
|
+
else
|
261
|
+
contextualize(parent)[k.to_sym]
|
262
|
+
end
|
257
263
|
arel_predicate_for(attribute, v, parent)
|
258
264
|
end
|
259
265
|
end
|
@@ -176,6 +176,12 @@ module Squeel
|
|
176
176
|
predicate.to_sql.should match /"people"."name" = "children_people"."name"/
|
177
177
|
end
|
178
178
|
|
179
|
+
it 'honors an explicit table in string keys' do
|
180
|
+
predicate = @v.accept('things.attribute' => 'retro')
|
181
|
+
predicate.should be_a Arel::Nodes::Equality
|
182
|
+
predicate.to_sql.should match /"things"."attribute" = 'retro'/
|
183
|
+
end
|
184
|
+
|
179
185
|
it 'visits ActiveRecord::Relation values in predicates' do
|
180
186
|
predicate = @v.accept(dsl{id >> Person.select{id}.limit(3).order{id.desc}})
|
181
187
|
predicate.should be_a Arel::Nodes::In
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: squeel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.7.
|
5
|
+
version: 0.7.2
|
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-05-
|
13
|
+
date: 2011-05-19 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|