arel 1.0.0.rc1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,8 @@ module Arel
|
|
4
4
|
|
5
5
|
def initialize(relation, predicates)
|
6
6
|
super(relation)
|
7
|
-
@predicates = predicates.map
|
7
|
+
@predicates = predicates.respond_to?(:map) ?
|
8
|
+
predicates.map { |p| p.bind(relation) } : [predicates.bind(relation)]
|
8
9
|
@wheres = nil
|
9
10
|
end
|
10
11
|
|
@@ -15,7 +15,7 @@ module Arel
|
|
15
15
|
when :binary then String
|
16
16
|
when :boolean then Boolean
|
17
17
|
else
|
18
|
-
|
18
|
+
Undefined
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -28,6 +28,11 @@ module Arel
|
|
28
28
|
@column.type_cast(value)
|
29
29
|
end
|
30
30
|
|
31
|
+
# Attribute type for column types that Arel doesn't know how to handle.
|
32
|
+
class Undefined < Arel::Attribute
|
33
|
+
include Attributes
|
34
|
+
end
|
35
|
+
|
31
36
|
%w(Boolean Decimal Float Integer String Time).each do |klass|
|
32
37
|
class_eval <<-R
|
33
38
|
class #{klass} < Arel::Attributes::#{klass}
|
data/lib/arel/version.rb
CHANGED
@@ -96,6 +96,11 @@ module Arel
|
|
96
96
|
@predicate = Predicates::Equality.new(@attribute1, @attribute2)
|
97
97
|
end
|
98
98
|
|
99
|
+
it "manufactures a where relation" do
|
100
|
+
where = @relation.where("intern\nnet")
|
101
|
+
where.to_sql.should =~ /intern\nnet/
|
102
|
+
end
|
103
|
+
|
99
104
|
it "manufactures a where relation" do
|
100
105
|
where = @relation.where(@predicate)
|
101
106
|
where.relation.should == @relation
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Arel
|
4
|
+
module Sql
|
5
|
+
describe 'Attributes' do
|
6
|
+
describe 'for' do
|
7
|
+
it 'should return undefined for undefined columns' do
|
8
|
+
thing = Struct.new(:type).new(:HELLO)
|
9
|
+
check Attributes.for(thing).should == Attributes::Undefined
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
9
|
- 0
|
10
|
-
|
11
|
-
version: 1.0.0.rc1
|
10
|
+
version: 1.0.0
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Bryan Helmkamp
|
@@ -18,7 +17,7 @@ autorequire:
|
|
18
17
|
bindir: bin
|
19
18
|
cert_chain: []
|
20
19
|
|
21
|
-
date: 2010-06-08 00:00:00
|
20
|
+
date: 2010-06-08 00:00:00 +09:00
|
22
21
|
default_executable:
|
23
22
|
dependencies:
|
24
23
|
- !ruby/object:Gem::Dependency
|
@@ -148,6 +147,7 @@ files:
|
|
148
147
|
- spec/attributes/integer_spec.rb
|
149
148
|
- spec/attributes/string_spec.rb
|
150
149
|
- spec/attributes/time_spec.rb
|
150
|
+
- spec/attributes_spec.rb
|
151
151
|
- spec/engines/memory/integration/joins/cross_engine_spec.rb
|
152
152
|
- spec/engines/memory/unit/relations/array_spec.rb
|
153
153
|
- spec/engines/memory/unit/relations/insert_spec.rb
|
@@ -227,14 +227,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
227
227
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
228
228
|
none: false
|
229
229
|
requirements:
|
230
|
-
- - "
|
230
|
+
- - ">="
|
231
231
|
- !ruby/object:Gem::Version
|
232
|
-
hash:
|
232
|
+
hash: 3
|
233
233
|
segments:
|
234
|
-
-
|
235
|
-
|
236
|
-
- 1
|
237
|
-
version: 1.3.1
|
234
|
+
- 0
|
235
|
+
version: "0"
|
238
236
|
requirements: []
|
239
237
|
|
240
238
|
rubyforge_project: arel
|
@@ -271,6 +269,7 @@ test_files:
|
|
271
269
|
- spec/attributes/integer_spec.rb
|
272
270
|
- spec/attributes/string_spec.rb
|
273
271
|
- spec/attributes/time_spec.rb
|
272
|
+
- spec/attributes_spec.rb
|
274
273
|
- spec/engines/memory/integration/joins/cross_engine_spec.rb
|
275
274
|
- spec/engines/memory/unit/relations/array_spec.rb
|
276
275
|
- spec/engines/memory/unit/relations/insert_spec.rb
|