activemodel 5.2.5 → 6.0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +185 -71
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +5 -3
  5. data/lib/active_model/attribute/user_provided_default.rb +1 -2
  6. data/lib/active_model/attribute.rb +3 -4
  7. data/lib/active_model/attribute_assignment.rb +1 -2
  8. data/lib/active_model/attribute_methods.rb +56 -15
  9. data/lib/active_model/attribute_mutation_tracker.rb +88 -34
  10. data/lib/active_model/attribute_set/builder.rb +1 -3
  11. data/lib/active_model/attribute_set/yaml_encoder.rb +1 -2
  12. data/lib/active_model/attribute_set.rb +2 -12
  13. data/lib/active_model/attributes.rb +60 -35
  14. data/lib/active_model/callbacks.rb +10 -8
  15. data/lib/active_model/conversion.rb +1 -1
  16. data/lib/active_model/dirty.rb +36 -99
  17. data/lib/active_model/errors.rb +105 -21
  18. data/lib/active_model/gem_version.rb +4 -4
  19. data/lib/active_model/naming.rb +20 -5
  20. data/lib/active_model/railtie.rb +6 -0
  21. data/lib/active_model/secure_password.rb +47 -48
  22. data/lib/active_model/serialization.rb +0 -1
  23. data/lib/active_model/serializers/json.rb +10 -9
  24. data/lib/active_model/translation.rb +1 -1
  25. data/lib/active_model/type/big_integer.rb +0 -1
  26. data/lib/active_model/type/binary.rb +1 -1
  27. data/lib/active_model/type/boolean.rb +0 -1
  28. data/lib/active_model/type/date.rb +0 -5
  29. data/lib/active_model/type/date_time.rb +3 -8
  30. data/lib/active_model/type/decimal.rb +0 -1
  31. data/lib/active_model/type/float.rb +0 -3
  32. data/lib/active_model/type/helpers/accepts_multiparameter_time.rb +4 -0
  33. data/lib/active_model/type/helpers/numeric.rb +9 -3
  34. data/lib/active_model/type/helpers/time_value.rb +17 -5
  35. data/lib/active_model/type/immutable_string.rb +0 -1
  36. data/lib/active_model/type/integer.rb +8 -20
  37. data/lib/active_model/type/registry.rb +11 -16
  38. data/lib/active_model/type/string.rb +2 -3
  39. data/lib/active_model/type/time.rb +1 -6
  40. data/lib/active_model/type/value.rb +0 -1
  41. data/lib/active_model/validations/absence.rb +1 -1
  42. data/lib/active_model/validations/acceptance.rb +33 -26
  43. data/lib/active_model/validations/callbacks.rb +0 -1
  44. data/lib/active_model/validations/clusivity.rb +1 -2
  45. data/lib/active_model/validations/confirmation.rb +2 -2
  46. data/lib/active_model/validations/format.rb +1 -2
  47. data/lib/active_model/validations/inclusion.rb +1 -1
  48. data/lib/active_model/validations/length.rb +1 -1
  49. data/lib/active_model/validations/numericality.rb +5 -4
  50. data/lib/active_model/validations/validates.rb +2 -3
  51. data/lib/active_model/validations.rb +0 -3
  52. data/lib/active_model/validator.rb +1 -2
  53. data/lib/active_model.rb +1 -1
  54. metadata +15 -12
@@ -63,7 +63,7 @@ module ActiveModel
63
63
  # and strings in shortcut form.
64
64
  #
65
65
  # validates :email, format: /@/
66
- # validates :gender, inclusion: %w(male female)
66
+ # validates :role, inclusion: %(admin contributor)
67
67
  # validates :password, length: 6..20
68
68
  #
69
69
  # When using shortcut form, ranges and arrays are passed to your
@@ -116,7 +116,7 @@ module ActiveModel
116
116
  key = "#{key.to_s.camelize}Validator"
117
117
 
118
118
  begin
119
- validator = key.include?("::".freeze) ? key.constantize : const_get(key)
119
+ validator = key.include?("::") ? key.constantize : const_get(key)
120
120
  rescue NameError
121
121
  raise ArgumentError, "Unknown validator: '#{key}'"
122
122
  end
@@ -150,7 +150,6 @@ module ActiveModel
150
150
  end
151
151
 
152
152
  private
153
-
154
153
  # When creating custom validators, it might be useful to be able to specify
155
154
  # additional default keys. This can be done by overwriting this method.
156
155
  def _validates_default_keys
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "active_support/core_ext/array/extract_options"
4
- require "active_support/core_ext/hash/keys"
5
- require "active_support/core_ext/hash/except"
6
4
 
7
5
  module ActiveModel
8
6
  # == Active \Model \Validations
@@ -404,7 +402,6 @@ module ActiveModel
404
402
  alias :read_attribute_for_validation :send
405
403
 
406
404
  private
407
-
408
405
  def run_validations!
409
406
  _run_validate_callbacks
410
407
  errors.empty?
@@ -90,7 +90,7 @@ module ActiveModel
90
90
  # class MyValidator < ActiveModel::Validator
91
91
  # def initialize(options={})
92
92
  # super
93
- # options[:class].send :attr_accessor, :custom_attribute
93
+ # options[:class].attr_accessor :custom_attribute
94
94
  # end
95
95
  # end
96
96
  class Validator
@@ -175,7 +175,6 @@ module ActiveModel
175
175
  end
176
176
 
177
177
  private
178
-
179
178
  def validate_each(record, attribute, value)
180
179
  @block.call(record, attribute, value)
181
180
  end
data/lib/active_model.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # Copyright (c) 2004-2018 David Heinemeier Hansson
4
+ # Copyright (c) 2004-2019 David Heinemeier Hansson
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining
7
7
  # a copy of this software and associated documentation files (the
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemodel
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.5
4
+ version: 6.0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-26 00:00:00.000000000 Z
11
+ date: 2022-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.5
19
+ version: 6.0.4.6
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: 5.2.5
26
+ version: 6.0.4.6
27
27
  description: A toolkit for building modeling frameworks like Active Record. Rich support
28
28
  for attributes, callbacks, validations, serialization, internationalization, and
29
29
  testing.
@@ -97,13 +97,16 @@ files:
97
97
  - lib/active_model/validations/with.rb
98
98
  - lib/active_model/validator.rb
99
99
  - lib/active_model/version.rb
100
- homepage: http://rubyonrails.org
100
+ homepage: https://rubyonrails.org
101
101
  licenses:
102
102
  - MIT
103
103
  metadata:
104
- source_code_uri: https://github.com/rails/rails/tree/v5.2.5/activemodel
105
- changelog_uri: https://github.com/rails/rails/blob/v5.2.5/activemodel/CHANGELOG.md
106
- post_install_message:
104
+ bug_tracker_uri: https://github.com/rails/rails/issues
105
+ changelog_uri: https://github.com/rails/rails/blob/v6.0.4.6/activemodel/CHANGELOG.md
106
+ documentation_uri: https://api.rubyonrails.org/v6.0.4.6/
107
+ mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
108
+ source_code_uri: https://github.com/rails/rails/tree/v6.0.4.6/activemodel
109
+ post_install_message:
107
110
  rdoc_options: []
108
111
  require_paths:
109
112
  - lib
@@ -111,15 +114,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
114
  requirements:
112
115
  - - ">="
113
116
  - !ruby/object:Gem::Version
114
- version: 2.2.2
117
+ version: 2.5.0
115
118
  required_rubygems_version: !ruby/object:Gem::Requirement
116
119
  requirements:
117
120
  - - ">="
118
121
  - !ruby/object:Gem::Version
119
122
  version: '0'
120
123
  requirements: []
121
- rubygems_version: 3.1.2
122
- signing_key:
124
+ rubygems_version: 3.2.22
125
+ signing_key:
123
126
  specification_version: 4
124
127
  summary: A toolkit for building modeling frameworks (part of Rails).
125
128
  test_files: []