activerecord 3.2.22 → 3.2.22.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d685d6b2e0591a43ef4db163eaacb4719da9b4ff
4
- data.tar.gz: b459417898a13e28e215bcab931e45acb6a6b420
3
+ metadata.gz: 0c7de371a9ff4f1930ac4112f73318b22f6f2cb0
4
+ data.tar.gz: 9d913b96cfe2ff711bd42ba9eebee48a636489ba
5
5
  SHA512:
6
- metadata.gz: e67ea6890e20adc8301230ed16d969ff4fb87a792f37cd4dc9436033f557bf319897b0b9e9ebe55d24d397ba1de730fc879f7fb2186f92f7002eacd70f52c5fb
7
- data.tar.gz: b053ac5da94cd12748373ff954db55f6a5fda9dccd6953a4e47a36909d71dd32ad1f53675fdf91f2faa3edbe3ae6d4362f4a50e5e85179405b44fcd1ac42cd1f
6
+ metadata.gz: 11af7f6f9567b67ea0bbaee3e7ee2e4ac009404c2f710b8a5cbf09272df259428cd13f3e1e326c8eb40fca12f27426315f0b615233a123f268ad657affe27c17
7
+ data.tar.gz: 6a7935255cf664ee6509e57c1256f07781270e9b1bdb6b6bfab9ddea0283f63d2f69c876df9418e42118964cd238e201cbba37ecdc3c0eca55a9064f9266be21
@@ -470,11 +470,12 @@ module ActiveRecord
470
470
  # has_destroy_flag? or if a <tt>:reject_if</tt> proc exists for this
471
471
  # association and evaluates to +true+.
472
472
  def reject_new_record?(association_name, attributes)
473
- has_destroy_flag?(attributes) || call_reject_if(association_name, attributes)
473
+ will_be_destroyed?(association_name, attributes) || call_reject_if(association_name, attributes)
474
474
  end
475
475
 
476
476
  def call_reject_if(association_name, attributes)
477
- return false if has_destroy_flag?(attributes)
477
+ return false if will_be_destroyed?(association_name, attributes)
478
+
478
479
  case callback = self.nested_attributes_options[association_name][:reject_if]
479
480
  when Symbol
480
481
  method(callback).arity == 0 ? send(callback) : send(callback, attributes)
@@ -483,6 +484,15 @@ module ActiveRecord
483
484
  end
484
485
  end
485
486
 
487
+ # Only take into account the destroy flag if <tt>:allow_destroy</tt> is true
488
+ def will_be_destroyed?(association_name, attributes)
489
+ allow_destroy?(association_name) && has_destroy_flag?(attributes)
490
+ end
491
+
492
+ def allow_destroy?(association_name)
493
+ self.nested_attributes_options[association_name][:allow_destroy]
494
+ end
495
+
486
496
  def raise_nested_attributes_record_not_found(association_name, record_id)
487
497
  raise RecordNotFound, "Couldn't find #{self.class.reflect_on_association(association_name).klass.name} with ID=#{record_id} for #{self.class.name} with ID=#{id}"
488
498
  end
@@ -3,7 +3,7 @@ module ActiveRecord
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
5
  TINY = 22
6
- PRE = nil
6
+ PRE = "1"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.22
4
+ version: 3.2.22.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-16 00:00:00.000000000 Z
11
+ date: 2016-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.2.22
19
+ version: 3.2.22.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.2.22
26
+ version: 3.2.22.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activemodel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.2.22
33
+ version: 3.2.22.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.2.22
40
+ version: 3.2.22.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: arel
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  version: '0'
247
247
  requirements: []
248
248
  rubyforge_project:
249
- rubygems_version: 2.4.5
249
+ rubygems_version: 2.5.1
250
250
  signing_key:
251
251
  specification_version: 4
252
252
  summary: Object-relational mapper framework (part of Rails).