activerecord 3.0.0 → 3.0.1

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 CHANGED
@@ -1,3 +1,7 @@
1
+ *Rails 3.0.1 (October 15, 2010)*
2
+
3
+ * Introduce a fix for CVE-2010-3993
4
+
1
5
  *Rails 3.0.0 (August 29, 2010)*
2
6
 
3
7
  * Changed update_attribute to not run callbacks and update the record directly in the database [Neeraj Singh]
@@ -296,9 +296,7 @@ module ActiveRecord
296
296
  assign_to_or_mark_for_destruction(record, attributes, options[:allow_destroy])
297
297
 
298
298
  elsif attributes['id']
299
- existing_record = self.class.reflect_on_association(association_name).klass.find(attributes['id'])
300
- assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy])
301
- self.send(association_name.to_s+'=', existing_record)
299
+ raise_nested_attributes_record_not_found(association_name, attributes['id'])
302
300
 
303
301
  elsif !reject_new_record?(association_name, attributes)
304
302
  method = "build_#{association_name}"
@@ -369,15 +367,12 @@ module ActiveRecord
369
367
  association.build(attributes.except(*UNASSIGNABLE_KEYS))
370
368
  end
371
369
 
372
- elsif existing_records.count == 0 #Existing record but not yet associated
373
- existing_record = self.class.reflect_on_association(association_name).klass.find(attributes['id'])
374
- association.send(:add_record_to_target_with_callbacks, existing_record) unless association.loaded?
375
- assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy])
376
-
377
370
  elsif existing_record = existing_records.detect { |record| record.id.to_s == attributes['id'].to_s }
378
371
  association.send(:add_record_to_target_with_callbacks, existing_record) unless association.loaded?
379
372
  assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy])
380
373
 
374
+ else
375
+ raise_nested_attributes_record_not_found(association_name, attributes['id'])
381
376
  end
382
377
  end
383
378
  end
@@ -397,7 +392,7 @@ module ActiveRecord
397
392
  ConnectionAdapters::Column.value_to_boolean(hash['_destroy'])
398
393
  end
399
394
 
400
- # Determines if a new record should be built by checking for
395
+ # Determines if a new record should be build by checking for
401
396
  # has_destroy_flag? or if a <tt>:reject_if</tt> proc exists for this
402
397
  # association and evaluates to +true+.
403
398
  def reject_new_record?(association_name, attributes)
@@ -413,5 +408,9 @@ module ActiveRecord
413
408
  end
414
409
  end
415
410
 
411
+ def raise_nested_attributes_record_not_found(association_name, record_id)
412
+ reflection = self.class.reflect_on_association(association_name)
413
+ raise RecordNotFound, "Couldn't find #{reflection.klass.name} with ID=#{record_id} for #{self.class.name} with ID=#{id}"
414
+ end
416
415
  end
417
416
  end
@@ -2,7 +2,7 @@ module ActiveRecord
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
5
4
  prerelease: false
6
5
  segments:
7
6
  - 3
8
7
  - 0
9
- - 0
10
- version: 3.0.0
8
+ - 1
9
+ version: 3.0.1
11
10
  platform: ruby
12
11
  authors:
13
12
  - David Heinemeier Hansson
@@ -15,50 +14,44 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-08-29 00:00:00 -05:00
17
+ date: 2010-10-15 00:00:00 +13:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: activesupport
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
25
  - - "="
28
26
  - !ruby/object:Gem::Version
29
- hash: 7
30
27
  segments:
31
28
  - 3
32
29
  - 0
33
- - 0
34
- version: 3.0.0
30
+ - 1
31
+ version: 3.0.1
35
32
  type: :runtime
36
33
  version_requirements: *id001
37
34
  - !ruby/object:Gem::Dependency
38
35
  name: activemodel
39
36
  prerelease: false
40
37
  requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
38
  requirements:
43
39
  - - "="
44
40
  - !ruby/object:Gem::Version
45
- hash: 7
46
41
  segments:
47
42
  - 3
48
43
  - 0
49
- - 0
50
- version: 3.0.0
44
+ - 1
45
+ version: 3.0.1
51
46
  type: :runtime
52
47
  version_requirements: *id002
53
48
  - !ruby/object:Gem::Dependency
54
49
  name: arel
55
50
  prerelease: false
56
51
  requirement: &id003 !ruby/object:Gem::Requirement
57
- none: false
58
52
  requirements:
59
53
  - - ~>
60
54
  - !ruby/object:Gem::Version
61
- hash: 23
62
55
  segments:
63
56
  - 1
64
57
  - 0
@@ -70,11 +63,9 @@ dependencies:
70
63
  name: tzinfo
71
64
  prerelease: false
72
65
  requirement: &id004 !ruby/object:Gem::Requirement
73
- none: false
74
66
  requirements:
75
67
  - - ~>
76
68
  - !ruby/object:Gem::Version
77
- hash: 61
78
69
  segments:
79
70
  - 0
80
71
  - 3
@@ -194,29 +185,25 @@ rdoc_options:
194
185
  require_paths:
195
186
  - lib
196
187
  required_ruby_version: !ruby/object:Gem::Requirement
197
- none: false
198
188
  requirements:
199
189
  - - ">="
200
190
  - !ruby/object:Gem::Version
201
- hash: 57
202
191
  segments:
203
192
  - 1
204
193
  - 8
205
194
  - 7
206
195
  version: 1.8.7
207
196
  required_rubygems_version: !ruby/object:Gem::Requirement
208
- none: false
209
197
  requirements:
210
198
  - - ">="
211
199
  - !ruby/object:Gem::Version
212
- hash: 3
213
200
  segments:
214
201
  - 0
215
202
  version: "0"
216
203
  requirements: []
217
204
 
218
205
  rubyforge_project: activerecord
219
- rubygems_version: 1.3.7
206
+ rubygems_version: 1.3.6
220
207
  signing_key:
221
208
  specification_version: 3
222
209
  summary: Object-relational mapper framework (part of Rails).