activerecord 4.1.14 → 4.1.14.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: ff24b6634312e9b26e1942801f371f41ae627587
4
- data.tar.gz: ead9fbf01d7f3cf05251ae8c018bfabc71024440
3
+ metadata.gz: 1489212186214a73777d963de01760759d6090d6
4
+ data.tar.gz: 5a62acdcafff52ec9519e64cb48702918fe84dde
5
5
  SHA512:
6
- metadata.gz: e0e17d92540919224520105bbce712432432960ad898df05efe45c873b56a71bb3e5ea99c56ad6944658da59370cdde6b8bdeec62225878a0a3031b1702c6b38
7
- data.tar.gz: b4559530cf01276b7c5c08fbd2f548a025ae2fcf8721853e6784f6a2c43aba3d45d0546f74b0bfd0fece7b426394497cb144c51146f737af850cf3e450633625
6
+ metadata.gz: 5f5d88460e4908a1533879ea674f2ba5d4b2e1ccd31dce40d0623d6386ef4a1b23ba377548ef98061ec19897609870214550b00999e6bf737b190f2924c410a2
7
+ data.tar.gz: 24679bfbe93c7bff82c74e448e997c11d5c0efddf4565a5ed891b770a3be21891d959fd8668b64d01baf3b56337986de7bb30ef94c7ccf53831ee975ac05beb0
@@ -68,7 +68,7 @@ module ActiveRecord
68
68
  # Where conditions on an enum attribute must use the ordinal value of an enum.
69
69
  module Enum
70
70
  def self.extended(base) # :nodoc:
71
- base.class_attribute(:defined_enums)
71
+ base.class_attribute(:defined_enums, instance_writer: false)
72
72
  base.defined_enums = {}
73
73
  end
74
74
 
@@ -8,7 +8,7 @@ module ActiveRecord
8
8
  MAJOR = 4
9
9
  MINOR = 1
10
10
  TINY = 14
11
- PRE = nil
11
+ PRE = "1"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
@@ -523,7 +523,7 @@ module ActiveRecord
523
523
  # has_destroy_flag? or if a <tt>:reject_if</tt> proc exists for this
524
524
  # association and evaluates to +true+.
525
525
  def reject_new_record?(association_name, attributes)
526
- has_destroy_flag?(attributes) || call_reject_if(association_name, attributes)
526
+ will_be_destroyed?(association_name, attributes) || call_reject_if(association_name, attributes)
527
527
  end
528
528
 
529
529
  # Determines if a record with the particular +attributes+ should be
@@ -532,7 +532,8 @@ module ActiveRecord
532
532
  #
533
533
  # Returns false if there is a +destroy_flag+ on the attributes.
534
534
  def call_reject_if(association_name, attributes)
535
- return false if has_destroy_flag?(attributes)
535
+ return false if will_be_destroyed?(association_name, attributes)
536
+
536
537
  case callback = self.nested_attributes_options[association_name][:reject_if]
537
538
  when Symbol
538
539
  method(callback).arity == 0 ? send(callback) : send(callback, attributes)
@@ -541,6 +542,15 @@ module ActiveRecord
541
542
  end
542
543
  end
543
544
 
545
+ # Only take into account the destroy flag if <tt>:allow_destroy</tt> is true
546
+ def will_be_destroyed?(association_name, attributes)
547
+ allow_destroy?(association_name) && has_destroy_flag?(attributes)
548
+ end
549
+
550
+ def allow_destroy?(association_name)
551
+ self.nested_attributes_options[association_name][:allow_destroy]
552
+ end
553
+
544
554
  def raise_nested_attributes_record_not_found!(association_name, record_id)
545
555
  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}"
546
556
  end
@@ -4,8 +4,8 @@ module ActiveRecord
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
7
- class_attribute :_reflections
8
- class_attribute :aggregate_reflections
7
+ class_attribute :_reflections, instance_writer: false
8
+ class_attribute :aggregate_reflections, instance_writer: false
9
9
  self._reflections = {}
10
10
  self.aggregate_reflections = {}
11
11
  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: 4.1.14
4
+ version: 4.1.14.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-11-12 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: 4.1.14
19
+ version: 4.1.14.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: 4.1.14
26
+ version: 4.1.14.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: 4.1.14
33
+ version: 4.1.14.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: 4.1.14
40
+ version: 4.1.14.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: arel
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
248
  version: '0'
249
249
  requirements: []
250
250
  rubyforge_project:
251
- rubygems_version: 2.4.5.1
251
+ rubygems_version: 2.5.1
252
252
  signing_key:
253
253
  specification_version: 4
254
254
  summary: Object-relational mapper framework (part of Rails).