can_has_validations 1.11.1 → 1.12.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93eb576442685b58ac4e17cebf3c3a95ff9469e504711cf21139ceae1ce2535f
4
- data.tar.gz: c18178014c06da3ea3ddca1bdaba444e66d4fca9a92c8ae0dc136c113b88e626
3
+ metadata.gz: 13e394fba7dc57b9c99ee269fe7c1bbb868e3f5622ed98a2b142a5ffc7ca4fec
4
+ data.tar.gz: bf2d29c9de0698c7cc9bc734534e556f7b6625f61ba032cef15ccb71f4e7ac70
5
5
  SHA512:
6
- metadata.gz: '04128aea6dda3a4fe0f484333d2bde2aa0c8563adff238627854b7d4266c7e6aa4d68ebba91717ebdbc31598b23199d5950d2a829b555bcd73b11631f6a4042b'
7
- data.tar.gz: d6bdf830b2ebcd33c68dfb9323889eea393b905cc8b1f207281732bb0c700046edc08e79c06f4ba3a58401ed484c2ee82a4655c5837c28da6d962e358b405035
6
+ metadata.gz: 64c45df4c4266413b999c21aff1356ddfb2178e7dc54e115638f9b08c6a50c2f12c237a2573ecd4684665b3b7690cd408cc4b5b8f58ba34dd74f5a8e520b6436
7
+ data.tar.gz: b6b3ec67d6711a4e8a6fabcf1ee018bf58f003fc29f0500e5bec21d85e34d9104ec5ccc2dfe46f4f4a287d986cb0f44872bcf0ed5e3dbe14f55c521ef283c5d6
@@ -7,6 +7,9 @@
7
7
  # validates :database, url: {port: [5432, nil]}
8
8
  # to allow scheme's default port, must specify `nil` too
9
9
  # :scheme defaults to `%w(http https)`
10
+ # to allow any, use `scheme: nil`
11
+ # to require blank, use `scheme: [nil]`
12
+ # note: to allow no scheme, uri must still start with '//'
10
13
  # :host defaults to `nil` which allows any
11
14
  # :port defaults to `nil` which allows any
12
15
  # to require blank, use `port: false` or `port: [nil]`
@@ -26,6 +29,8 @@ module ActiveModel::Validations
26
29
  options[:scheme].call(record)
27
30
  elsif options[:scheme].is_a?(Symbol)
28
31
  record.send(options[:scheme])
32
+ elsif options.key?(:scheme) && options[:scheme].nil?
33
+ [u&.scheme]
29
34
  else
30
35
  Array.wrap(options[:scheme] || %w(http https))
31
36
  end
@@ -54,7 +59,7 @@ module ActiveModel::Validations
54
59
  Array.wrap(options[:port])
55
60
  end
56
61
 
57
- if !u || !u2 || u.relative? || allowed_schemes.exclude?(u.scheme) || allowed_hosts.exclude?(u.host) || allowed_ports.exclude?(u.port)
62
+ if !u || !u2 || allowed_schemes.exclude?(u.scheme) || allowed_hosts.exclude?(u.host) || allowed_ports.exclude?(u.port)
58
63
  record.errors.add(attribute, :invalid_url, **options.merge(value: value, scheme: allowed_schemes, host: allowed_hosts, port: allowed_ports))
59
64
  end
60
65
  end
@@ -1,3 +1,3 @@
1
1
  module CanHasValidations
2
- VERSION = '1.11.1'
2
+ VERSION = '1.12.0'
3
3
  end
@@ -118,3 +118,10 @@ Generating image variants require the image_processing gem. Please add `gem "ima
118
118
  CanHasValidationsTest: test_truth
119
119
  ---------------------------------
120
120
  TRANSACTION (0.0ms) ROLLBACK TRANSACTION
121
+ Generating image variants require the image_processing gem. Please add `gem "image_processing", "~> 1.2"` to your Gemfile or set `config.active_storage.variant_processor = :disabled`.
122
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
123
+ TRANSACTION (0.0ms) BEGIN deferred TRANSACTION
124
+ ---------------------------------
125
+ CanHasValidationsTest: test_truth
126
+ ---------------------------------
127
+ TRANSACTION (0.0ms) ROLLBACK TRANSACTION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: can_has_validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.1
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thomas morgan