activerecord 3.2.4.rc1 → 3.2.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activerecord might be problematic. Click here for more details.
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
## Rails 3.2.4 (
|
1
|
+
## Rails 3.2.4 (May 31, 2012) ##
|
2
2
|
|
3
3
|
* Perf fix: Don't load the records when doing assoc.delete_all.
|
4
4
|
GH #6289. *Jon Leighton*
|
@@ -7,6 +7,15 @@
|
|
7
7
|
This could cause infinite recursion and potentially other problems.
|
8
8
|
See GH #5667. *Jon Leighton*
|
9
9
|
|
10
|
+
* Datetime attributes are forced to be changed. GH #3965
|
11
|
+
|
12
|
+
* Fix attribute casting. GH #5549
|
13
|
+
|
14
|
+
* Fix #5667. Preloading should ignore scoping.
|
15
|
+
|
16
|
+
* Predicate builder should not recurse for determining where columns.
|
17
|
+
Thanks to Ben Murphy for reporting this! CVE-2012-2661
|
18
|
+
|
10
19
|
## Rails 3.2.3 (March 30, 2012) ##
|
11
20
|
|
12
21
|
* Added find_or_create_by_{attribute}! dynamic method. *Andrew White*
|
@@ -75,7 +75,7 @@ module ActiveRecord
|
|
75
75
|
|
76
76
|
conditions.each do |condition|
|
77
77
|
if options[:through] && condition.is_a?(Hash)
|
78
|
-
condition =
|
78
|
+
condition = disambiguate_condition(table, condition)
|
79
79
|
end
|
80
80
|
|
81
81
|
scope = scope.where(interpolate(condition))
|
@@ -114,6 +114,21 @@ module ActiveRecord
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
+
def disambiguate_condition(table, condition)
|
118
|
+
if condition.is_a?(Hash)
|
119
|
+
Hash[
|
120
|
+
condition.map do |k, v|
|
121
|
+
if v.is_a?(Hash)
|
122
|
+
[k, v]
|
123
|
+
else
|
124
|
+
[table.table_alias || table.name, { k => v }]
|
125
|
+
end
|
126
|
+
end
|
127
|
+
]
|
128
|
+
else
|
129
|
+
condition
|
130
|
+
end
|
131
|
+
end
|
117
132
|
end
|
118
133
|
end
|
119
134
|
end
|
data/lib/active_record/base.rb
CHANGED
@@ -450,12 +450,12 @@ module ActiveRecord #:nodoc:
|
|
450
450
|
private
|
451
451
|
|
452
452
|
def relation #:nodoc:
|
453
|
-
relation ||= Relation.new(self, arel_table)
|
453
|
+
@relation ||= Relation.new(self, arel_table)
|
454
454
|
|
455
455
|
if finder_needs_type_condition?
|
456
|
-
relation.where(type_condition).create_with(inheritance_column.to_sym => sti_name)
|
456
|
+
@relation.where(type_condition).create_with(inheritance_column.to_sym => sti_name)
|
457
457
|
else
|
458
|
-
relation
|
458
|
+
@relation
|
459
459
|
end
|
460
460
|
end
|
461
461
|
end
|
@@ -489,6 +489,7 @@ module ActiveRecord #:nodoc:
|
|
489
489
|
@marked_for_destruction = false
|
490
490
|
@previously_changed = {}
|
491
491
|
@changed_attributes = {}
|
492
|
+
@relation = nil
|
492
493
|
|
493
494
|
ensure_proper_type
|
494
495
|
|
@@ -1,16 +1,16 @@
|
|
1
1
|
module ActiveRecord
|
2
2
|
class PredicateBuilder # :nodoc:
|
3
|
-
def self.build_from_hash(engine, attributes, default_table)
|
3
|
+
def self.build_from_hash(engine, attributes, default_table, check_column = true)
|
4
4
|
predicates = attributes.map do |column, value|
|
5
5
|
table = default_table
|
6
6
|
|
7
7
|
if value.is_a?(Hash)
|
8
8
|
table = Arel::Table.new(column, engine)
|
9
|
-
build_from_hash(engine, value, table)
|
9
|
+
build_from_hash(engine, value, table, false)
|
10
10
|
else
|
11
11
|
column = column.to_s
|
12
12
|
|
13
|
-
if column.include?('.')
|
13
|
+
if check_column && column.include?('.')
|
14
14
|
table_name, column = column.split('.', 2)
|
15
15
|
table = Arel::Table.new(table_name, engine)
|
16
16
|
end
|
metadata
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 7
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
9
|
- 4
|
10
|
-
|
11
|
-
- 1
|
12
|
-
version: 3.2.4.rc1
|
10
|
+
version: 3.2.4
|
13
11
|
platform: ruby
|
14
12
|
authors:
|
15
13
|
- David Heinemeier Hansson
|
@@ -17,7 +15,7 @@ autorequire:
|
|
17
15
|
bindir: bin
|
18
16
|
cert_chain: []
|
19
17
|
|
20
|
-
date: 2012-05-
|
18
|
+
date: 2012-05-31 00:00:00 Z
|
21
19
|
dependencies:
|
22
20
|
- !ruby/object:Gem::Dependency
|
23
21
|
name: activesupport
|
@@ -27,14 +25,12 @@ dependencies:
|
|
27
25
|
requirements:
|
28
26
|
- - "="
|
29
27
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
28
|
+
hash: 7
|
31
29
|
segments:
|
32
30
|
- 3
|
33
31
|
- 2
|
34
32
|
- 4
|
35
|
-
|
36
|
-
- 1
|
37
|
-
version: 3.2.4.rc1
|
33
|
+
version: 3.2.4
|
38
34
|
type: :runtime
|
39
35
|
version_requirements: *id001
|
40
36
|
- !ruby/object:Gem::Dependency
|
@@ -45,14 +41,12 @@ dependencies:
|
|
45
41
|
requirements:
|
46
42
|
- - "="
|
47
43
|
- !ruby/object:Gem::Version
|
48
|
-
hash:
|
44
|
+
hash: 7
|
49
45
|
segments:
|
50
46
|
- 3
|
51
47
|
- 2
|
52
48
|
- 4
|
53
|
-
|
54
|
-
- 1
|
55
|
-
version: 3.2.4.rc1
|
49
|
+
version: 3.2.4
|
56
50
|
type: :runtime
|
57
51
|
version_requirements: *id002
|
58
52
|
- !ruby/object:Gem::Dependency
|
@@ -268,14 +262,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
268
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
269
263
|
none: false
|
270
264
|
requirements:
|
271
|
-
- - "
|
265
|
+
- - ">="
|
272
266
|
- !ruby/object:Gem::Version
|
273
|
-
hash:
|
267
|
+
hash: 3
|
274
268
|
segments:
|
275
|
-
-
|
276
|
-
|
277
|
-
- 1
|
278
|
-
version: 1.3.1
|
269
|
+
- 0
|
270
|
+
version: "0"
|
279
271
|
requirements: []
|
280
272
|
|
281
273
|
rubyforge_project:
|