can_has_validations 1.5.0 → 1.7.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: a60d6f36d2de2de081e45e2608c207d3cc81447900b2f0c7ef61727373fb2819
4
- data.tar.gz: aed858aa2888e7646b3878dd039052b0196d9a41e64188bcf45f494dc3bb0e6d
3
+ metadata.gz: bb51b71bb23aabfeb3e1bde9ad0f03119d4011d60c7117971c606266eb0c477a
4
+ data.tar.gz: 5b101d95e237b874ff096f9658c064709aef19228c3444f6ed6878fb1f5cc1c5
5
5
  SHA512:
6
- metadata.gz: db744b1438739df7fd6aae9d071ccbae7683c405fab61ff56307045d2312760b8559b950246a8c578aa3e58c6fdff3d0bbe8f7a27c520d95ea92902b9ef2ef52
7
- data.tar.gz: 17486807b2bede046e96282943b8dfa76154e4283d20b8ec18958154f75a24508e919786f2b5e2f802315ee4246c41bfa187b24f93769e67d14767496c34c419
6
+ metadata.gz: 82e3dc6177df9d32216bbefbbfeef97ccb4bebf22d5b8431c9d59393fd619f2d465b52f3c26eb84c551f35c154279e54c5689d595e699de0b65d211bc115c0ef
7
+ data.tar.gz: fe709a9a7225cf2ea6eb7828c4d741b11c07181a32710d394972ddb424bc282d44d9f163388451671577ff0ebf96c28b3921f46d60b63e61f8be2384a0702e08
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2012-2021 thomas morgan
1
+ Copyright 2012-2023 thomas morgan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -0,0 +1,12 @@
1
+ ja:
2
+ errors:
3
+ messages:
4
+ invalid_email: は無効なメールです。
5
+ invalid_hostname: は無効なホスト名です。
6
+ invalid_ip: は無効な IP です。
7
+ ip_not_allowed: は許可された IP ではありません。
8
+ single_ip_required: は、単一の IP である必要があります。
9
+ invalid_url: は無効な URL です。
10
+ unchangeable: は変更できません。
11
+ before: は、 %{attribute2} の前でなければなりません。
12
+ after: は、 %{attribute2} の後でなければなりません。
@@ -37,6 +37,7 @@ module ActiveModel::Validations
37
37
  RESERVED_OPTIONS = %i(allow_ip allow_slash allow_underscore allow_wildcard)
38
38
 
39
39
  def validate_each(record, attribute, value)
40
+ value = value.to_s
40
41
  case options[:allow_ip]
41
42
  when 4, '4'
42
43
  return if value =~ Resolv::IPv4::Regex
@@ -3,26 +3,59 @@
3
3
  # eg: validates :website, url: true
4
4
  # validates :redis, url: {scheme: 'redis'}
5
5
  # validates :database, url: {scheme: %w(postgres mysql)}
6
+ # validates :website, url: {host: 'example.com'}
7
+ # validates :database, url: {port: [5432, nil]}
8
+ # to allow scheme's default port, must specify `nil` too
9
+ # :scheme defaults to `%w(http https)`
10
+ # :host defaults to `nil` which allows any
11
+ # :port defaults to `nil` which allows any
12
+ # to require blank, use `port: false` or `port: [nil]`
6
13
 
7
14
  module ActiveModel::Validations
8
15
  class UrlValidator < ActiveModel::EachValidator
9
16
  def validate_each(record, attribute, value)
10
- allowed_schemes = if options[:scheme].respond_to?(:call)
11
- options[:scheme].call(record)
12
- elsif options[:scheme].is_a?(Symbol)
13
- record.send(options[:scheme])
14
- else
15
- Array.wrap(options[:scheme] || %w(http https))
16
- end
17
-
18
17
  if defined?(Addressable::URI)
19
18
  u = Addressable::URI.parse(value) rescue nil
20
19
  u2 = u && URI.parse(u.normalize.to_s) rescue nil
21
20
  else
22
21
  u2 = u = URI.parse(value) rescue nil
23
22
  end
24
- if !u || !u2 || u.relative? || allowed_schemes.exclude?(u.scheme)
25
- record.errors.add(attribute, :invalid_url, **options.merge(value: value, scheme: allowed_schemes))
23
+
24
+ allowed_schemes =
25
+ if options[:scheme].respond_to?(:call)
26
+ options[:scheme].call(record)
27
+ elsif options[:scheme].is_a?(Symbol)
28
+ record.send(options[:scheme])
29
+ else
30
+ Array.wrap(options[:scheme] || %w(http https))
31
+ end
32
+
33
+ allowed_hosts =
34
+ if options[:host].respond_to?(:call)
35
+ options[:host].call(record)
36
+ elsif options[:host].is_a?(Symbol)
37
+ record.send(options[:host])
38
+ elsif options[:host].nil?
39
+ [u&.host]
40
+ else
41
+ Array.wrap(options[:host])
42
+ end
43
+
44
+ allowed_ports =
45
+ if options[:port].respond_to?(:call)
46
+ options[:port].call(record)
47
+ elsif options[:port].is_a?(Symbol)
48
+ record.send(options[:port])
49
+ elsif options[:port].nil?
50
+ [u&.port]
51
+ elsif options[:port] == false
52
+ [nil]
53
+ else
54
+ Array.wrap(options[:port])
55
+ end
56
+
57
+ if !u || !u2 || u.relative? || allowed_schemes.exclude?(u.scheme) || allowed_hosts.exclude?(u.host) || allowed_ports.exclude?(u.port)
58
+ record.errors.add(attribute, :invalid_url, **options.merge(value: value, scheme: allowed_schemes, host: allowed_hosts, port: allowed_ports))
26
59
  end
27
60
  end
28
61
  end
@@ -1,3 +1,3 @@
1
1
  module CanHasValidations
2
- VERSION = '1.5.0'
2
+ VERSION = '1.7.0'
3
3
  end
@@ -6,4 +6,6 @@ end
6
6
 
7
7
 
8
8
  require 'active_support/i18n'
9
- I18n.load_path << File.dirname(__FILE__) + '/can_has_validations/locale/en.yml'
9
+ Dir[File.join(__dir__, 'can_has_validations', 'locale', '*.yml')].each do |fn|
10
+ I18n.load_path << fn
11
+ end
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path("../config/application", __dir__)
3
+ require_relative "../config/boot"
4
+ require "rails/commands"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative "../config/boot"
3
+ require "rake"
4
+ Rake.application.run
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+ require "fileutils"
3
+
4
+ # path to your application root.
5
+ APP_ROOT = File.expand_path("..", __dir__)
6
+
7
+ def system!(*args)
8
+ system(*args) || abort("\n== Command #{args} failed ==")
9
+ end
10
+
11
+ FileUtils.chdir APP_ROOT do
12
+ # This script is a way to set up or update your development environment automatically.
13
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
14
+ # Add necessary setup steps to this file.
15
+
16
+ puts "== Installing dependencies =="
17
+ system! "gem install bundler --conservative"
18
+ system("bundle check") || system!("bundle install")
19
+
20
+ # puts "\n== Copying sample files =="
21
+ # unless File.exist?("config/database.yml")
22
+ # FileUtils.cp "config/database.yml.sample", "config/database.yml"
23
+ # end
24
+
25
+ puts "\n== Preparing database =="
26
+ system! "bin/rails db:prepare"
27
+
28
+ puts "\n== Removing old logs and tempfiles =="
29
+ system! "bin/rails log:clear tmp:clear"
30
+
31
+ puts "\n== Restarting application server =="
32
+ system! "bin/rails restart"
33
+ end
@@ -1,59 +1,23 @@
1
- require File.expand_path('../boot', __FILE__)
1
+ require_relative "boot"
2
2
 
3
- require 'rails/all'
3
+ require "rails/all"
4
4
 
5
- Bundler.require
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(*Rails.groups)
6
8
  require "can_has_validations"
7
9
 
8
10
  module Dummy
9
11
  class Application < Rails::Application
10
- # Settings in config/environments/* take precedence over those specified here.
11
- # Application configuration should go into files in config/initializers
12
- # -- all .rb files in that directory are automatically loaded.
13
-
14
- # Custom directories with classes and modules you want to be autoloadable.
15
- # config.autoload_paths += %W(#{config.root}/extras)
16
-
17
- # Only load the plugins named here, in the order given (default is alphabetical).
18
- # :all can be used as a placeholder for all plugins not explicitly named.
19
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
20
-
21
- # Activate observers that should always be running.
22
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
23
-
24
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26
- # config.time_zone = 'Central Time (US & Canada)'
27
-
28
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
29
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30
- # config.i18n.default_locale = :de
31
-
32
- # Configure the default encoding used in templates for Ruby 1.9.
33
- config.encoding = "utf-8"
34
-
35
- # Configure sensitive parameters which will be filtered from the log file.
36
- config.filter_parameters += [:password]
37
-
38
- # Enable escaping HTML in JSON.
39
- config.active_support.escape_html_entities_in_json = true
40
-
41
- # Use SQL instead of Active Record's schema dumper when creating the database.
42
- # This is necessary if your schema can't be completely dumped by the schema dumper,
43
- # like if you have constraints or database-specific column types
44
- # config.active_record.schema_format = :sql
45
-
46
- # Enforce whitelist mode for mass assignment.
47
- # This will create an empty whitelist of attributes available for mass-assignment for all models
48
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
49
- # parameters by using an attr_accessible or attr_protected declaration.
50
- config.active_record.whitelist_attributes = true
51
-
52
- # Enable the asset pipeline
53
- config.assets.enabled = true
54
-
55
- # Version of your assets, change this if you want to expire all your assets
56
- config.assets.version = '1.0'
12
+ # Initialize configuration defaults for originally generated Rails version.
13
+ config.load_defaults 7.0
14
+
15
+ # Configuration for the application, engines, and railties goes here.
16
+ #
17
+ # These settings can be overridden in specific environments using the files
18
+ # in config/environments, which are processed later.
19
+ #
20
+ # config.time_zone = "Central Time (US & Canada)"
21
+ # config.eager_load_paths << Rails.root.join("extras")
57
22
  end
58
23
  end
59
-
@@ -1,10 +1,3 @@
1
- require 'rubygems'
2
- gemfile = File.expand_path('../../../../Gemfile', __FILE__)
1
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
3
2
 
4
- if File.exist?(gemfile)
5
- ENV['BUNDLE_GEMFILE'] = gemfile
6
- require 'bundler'
7
- Bundler.setup
8
- end
9
-
10
- $:.unshift File.expand_path('../../../../lib', __FILE__)
3
+ require "bundler/setup" # Set up gems listed in the Gemfile.
@@ -0,0 +1,10 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: test
6
+
7
+ production:
8
+ adapter: redis
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
+ channel_prefix: dummy_production
@@ -1,5 +1,5 @@
1
- # Load the rails application
2
- require File.expand_path('../application', __FILE__)
1
+ # Load the Rails application.
2
+ require_relative "application"
3
3
 
4
- # Initialize the rails application
5
- Dummy::Application.initialize!
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -1,37 +1,68 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ require "active_support/core_ext/integer/time"
3
2
 
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # In the development environment your application's code is reloaded any time
7
+ # it changes. This slows down response time but is perfect for development
6
8
  # since you don't have to restart the web server when you make code changes.
7
9
  config.cache_classes = false
8
10
 
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
11
+ # Do not eager load code on boot.
12
+ config.eager_load = false
13
+
14
+ # Show full error reports.
15
+ config.consider_all_requests_local = true
16
+
17
+ # Enable server timing
18
+ config.server_timing = true
19
+
20
+ # Enable/disable caching. By default caching is disabled.
21
+ # Run rails dev:cache to toggle caching.
22
+ if Rails.root.join("tmp/caching-dev.txt").exist?
23
+ config.action_controller.perform_caching = true
24
+ config.action_controller.enable_fragment_cache_logging = true
25
+
26
+ config.cache_store = :memory_store
27
+ config.public_file_server.headers = {
28
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
29
+ }
30
+ else
31
+ config.action_controller.perform_caching = false
11
32
 
12
- # Show full error reports and disable caching
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
33
+ config.cache_store = :null_store
34
+ end
15
35
 
16
- # Don't care if the mailer can't send
36
+ # Store uploaded files on the local file system (see config/storage.yml for options).
37
+ config.active_storage.service = :local
38
+
39
+ # Don't care if the mailer can't send.
17
40
  config.action_mailer.raise_delivery_errors = false
18
41
 
19
- # Print deprecation notices to the Rails logger
42
+ config.action_mailer.perform_caching = false
43
+
44
+ # Print deprecation notices to the Rails logger.
20
45
  config.active_support.deprecation = :log
21
46
 
22
- # Only use best-standards-support built into browsers
23
- config.action_dispatch.best_standards_support = :builtin
47
+ # Raise exceptions for disallowed deprecations.
48
+ config.active_support.disallowed_deprecation = :raise
49
+
50
+ # Tell Active Support which deprecation messages to disallow.
51
+ config.active_support.disallowed_deprecation_warnings = []
52
+
53
+ # Raise an error on page load if there are pending migrations.
54
+ config.active_record.migration_error = :page_load
55
+
56
+ # Highlight code that triggered database queries in logs.
57
+ config.active_record.verbose_query_logs = true
24
58
 
25
- # Raise exception on mass assignment protection for Active Record models
26
- config.active_record.mass_assignment_sanitizer = :strict
27
59
 
28
- # Log the query plan for queries taking more than this (works
29
- # with SQLite, MySQL, and PostgreSQL)
30
- config.active_record.auto_explain_threshold_in_seconds = 0.5
60
+ # Raises error for missing translations.
61
+ # config.i18n.raise_on_missing_translations = true
31
62
 
32
- # Do not compress assets
33
- config.assets.compress = false
63
+ # Annotate rendered view with file names.
64
+ # config.action_view.annotate_rendered_view_with_filenames = true
34
65
 
35
- # Expands the lines which load the assets
36
- config.assets.debug = true
66
+ # Uncomment if you wish to allow Action Cable access from any origin.
67
+ # config.action_cable.disable_request_forgery_protection = true
37
68
  end
@@ -1,67 +1,87 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ require "active_support/core_ext/integer/time"
3
2
 
4
- # Code is not reloaded between requests
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # Code is not reloaded between requests.
5
7
  config.cache_classes = true
6
8
 
7
- # Full error reports are disabled and caching is turned on
9
+ # Eager load code on boot. This eager loads most of Rails and
10
+ # your application in memory, allowing both threaded web servers
11
+ # and those relying on copy on write to perform better.
12
+ # Rake tasks automatically ignore this option for performance.
13
+ config.eager_load = true
14
+
15
+ # Full error reports are disabled and caching is turned on.
8
16
  config.consider_all_requests_local = false
9
17
  config.action_controller.perform_caching = true
10
18
 
11
- # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_assets = false
19
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
20
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
21
+ # config.require_master_key = true
13
22
 
14
- # Compress JavaScripts and CSS
15
- config.assets.compress = true
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
16
26
 
17
- # Don't fallback to assets pipeline if a precompiled asset is missed
18
- config.assets.compile = false
27
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
28
+ # config.asset_host = "http://assets.example.com"
19
29
 
20
- # Generate digests for assets URLs
21
- config.assets.digest = true
30
+ # Specifies the header that your server uses for sending files.
31
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
32
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
22
33
 
23
- # Defaults to nil and saved in location specified by config.assets.prefix
24
- # config.assets.manifest = YOUR_PATH
34
+ # Store uploaded files on the local file system (see config/storage.yml for options).
35
+ config.active_storage.service = :local
25
36
 
26
- # Specifies the header that your server uses for sending files
27
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
37
+ # Mount Action Cable outside main process or domain.
38
+ # config.action_cable.mount_path = nil
39
+ # config.action_cable.url = "wss://example.com/cable"
40
+ # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
29
41
 
30
42
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
43
  # config.force_ssl = true
32
44
 
33
- # See everything in the log (default is :info)
34
- # config.log_level = :debug
45
+ # Include generic and useful information about system operation, but avoid logging too much
46
+ # information to avoid inadvertent exposure of personally identifiable information (PII).
47
+ config.log_level = :info
35
48
 
36
- # Prepend all log lines with the following tags
37
- # config.log_tags = [ :subdomain, :uuid ]
49
+ # Prepend all log lines with the following tags.
50
+ config.log_tags = [ :request_id ]
38
51
 
39
- # Use a different logger for distributed setups
40
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41
-
42
- # Use a different cache store in production
52
+ # Use a different cache store in production.
43
53
  # config.cache_store = :mem_cache_store
44
54
 
45
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
46
- # config.action_controller.asset_host = "http://assets.example.com"
55
+ # Use a real queuing backend for Active Job (and separate queues per environment).
56
+ # config.active_job.queue_adapter = :resque
57
+ # config.active_job.queue_name_prefix = "dummy_production"
47
58
 
48
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
49
- # config.assets.precompile += %w( search.js )
59
+ config.action_mailer.perform_caching = false
50
60
 
51
- # Disable delivery errors, bad email addresses will be ignored
61
+ # Ignore bad email addresses and do not raise email delivery errors.
62
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
52
63
  # config.action_mailer.raise_delivery_errors = false
53
64
 
54
- # Enable threaded mode
55
- # config.threadsafe!
56
-
57
65
  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58
- # the I18n.default_locale when a translation can not be found)
66
+ # the I18n.default_locale when a translation cannot be found).
59
67
  config.i18n.fallbacks = true
60
68
 
61
- # Send deprecation notices to registered listeners
62
- config.active_support.deprecation = :notify
69
+ # Don't log any deprecations.
70
+ config.active_support.report_deprecations = false
71
+
72
+ # Use default logging formatter so that PID and timestamp are not suppressed.
73
+ config.log_formatter = ::Logger::Formatter.new
74
+
75
+ # Use a different logger for distributed setups.
76
+ # require "syslog/logger"
77
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
78
+
79
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
80
+ logger = ActiveSupport::Logger.new(STDOUT)
81
+ logger.formatter = config.log_formatter
82
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
83
+ end
63
84
 
64
- # Log the query plan for queries taking more than this (works
65
- # with SQLite, MySQL, and PostgreSQL)
66
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
85
+ # Do not dump schema after migrations.
86
+ config.active_record.dump_schema_after_migration = false
67
87
  end
@@ -1,37 +1,60 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb
1
+ require "active_support/core_ext/integer/time"
3
2
 
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
3
+ # The test environment is used exclusively to run your application's
4
+ # test suite. You never need to work with it otherwise. Remember that
5
+ # your test database is "scratch space" for the test suite and is wiped
6
+ # and recreated between test runs. Don't rely on the data there!
7
+
8
+ Rails.application.configure do
9
+ # Settings specified here will take precedence over those in config/application.rb.
10
+
11
+ # Turn false under Spring and add config.action_view.cache_template_loading = true.
8
12
  config.cache_classes = true
9
13
 
10
- # Configure static asset server for tests with Cache-Control for performance
11
- config.serve_static_assets = true
12
- config.static_cache_control = "public, max-age=3600"
14
+ # Eager loading loads your whole application. When running a single test locally,
15
+ # this probably isn't necessary. It's a good idea to do in a continuous integration
16
+ # system, or in some way before deploying your code.
17
+ config.eager_load = ENV["CI"].present?
13
18
 
14
- # Log error messages when you accidentally call methods on nil
15
- config.whiny_nils = true
19
+ # Configure public file server for tests with Cache-Control for performance.
20
+ config.public_file_server.enabled = true
21
+ config.public_file_server.headers = {
22
+ "Cache-Control" => "public, max-age=#{1.hour.to_i}"
23
+ }
16
24
 
17
- # Show full error reports and disable caching
25
+ # Show full error reports and disable caching.
18
26
  config.consider_all_requests_local = true
19
27
  config.action_controller.perform_caching = false
28
+ config.cache_store = :null_store
20
29
 
21
- # Raise exceptions instead of rendering exception templates
30
+ # Raise exceptions instead of rendering exception templates.
22
31
  config.action_dispatch.show_exceptions = false
23
32
 
24
- # Disable request forgery protection in test environment
25
- config.action_controller.allow_forgery_protection = false
33
+ # Disable request forgery protection in test environment.
34
+ config.action_controller.allow_forgery_protection = false
35
+
36
+ # Store uploaded files on the local file system in a temporary directory.
37
+ config.active_storage.service = :test
38
+
39
+ config.action_mailer.perform_caching = false
26
40
 
27
41
  # Tell Action Mailer not to deliver emails to the real world.
28
42
  # The :test delivery method accumulates sent emails in the
29
43
  # ActionMailer::Base.deliveries array.
30
44
  config.action_mailer.delivery_method = :test
31
45
 
32
- # Raise exception on mass assignment protection for Active Record models
33
- config.active_record.mass_assignment_sanitizer = :strict
34
-
35
- # Print deprecation notices to the stderr
46
+ # Print deprecation notices to the stderr.
36
47
  config.active_support.deprecation = :stderr
48
+
49
+ # Raise exceptions for disallowed deprecations.
50
+ config.active_support.disallowed_deprecation = :raise
51
+
52
+ # Tell Active Support which deprecation messages to disallow.
53
+ config.active_support.disallowed_deprecation_warnings = []
54
+
55
+ # Raises error for missing translations.
56
+ # config.i18n.raise_on_missing_translations = true
57
+
58
+ # Annotate rendered view with file names.
59
+ # config.action_view.annotate_rendered_view_with_filenames = true
37
60
  end
@@ -0,0 +1,26 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Define an application-wide content security policy
4
+ # For further information see the following documentation
5
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6
+
7
+ # Rails.application.configure do
8
+ # config.content_security_policy do |policy|
9
+ # policy.default_src :self, :https
10
+ # policy.font_src :self, :https, :data
11
+ # policy.img_src :self, :https, :data
12
+ # policy.object_src :none
13
+ # policy.script_src :self, :https
14
+ # policy.style_src :self, :https
15
+ # # Specify URI for violation reports
16
+ # # policy.report_uri "/csp-violation-report-endpoint"
17
+ # end
18
+ #
19
+ # # Generate session nonces for permitted importmap and inline scripts
20
+ # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21
+ # config.content_security_policy_nonce_directives = %w(script-src)
22
+ #
23
+ # # Report CSP violations to a specified URI. See:
24
+ # # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
25
+ # # config.content_security_policy_report_only = true
26
+ # end
@@ -0,0 +1,6 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [
5
+ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
6
+ ]
@@ -1,15 +1,16 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- # Add new inflection rules using the following format
4
- # (all these examples are active by default):
5
- # ActiveSupport::Inflector.inflections do |inflect|
6
- # inflect.plural /^(ox)$/i, '\1en'
7
- # inflect.singular /^(ox)en/i, '\1'
8
- # inflect.irregular 'person', 'people'
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, "\\1en"
8
+ # inflect.singular /^(ox)en/i, "\\1"
9
+ # inflect.irregular "person", "people"
9
10
  # inflect.uncountable %w( fish sheep )
10
11
  # end
11
- #
12
+
12
13
  # These inflection rules are supported but not enabled by default:
13
- # ActiveSupport::Inflector.inflections do |inflect|
14
- # inflect.acronym 'RESTful'
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym "RESTful"
15
16
  # end
@@ -0,0 +1,11 @@
1
+ # Define an application-wide HTTP permissions policy. For further
2
+ # information see https://developers.google.com/web/updates/2018/06/feature-policy
3
+ #
4
+ # Rails.application.config.permissions_policy do |f|
5
+ # f.camera :none
6
+ # f.gyroscope :none
7
+ # f.microphone :none
8
+ # f.usb :none
9
+ # f.fullscreen :self
10
+ # f.payment :self, "https://secure.example.com"
11
+ # end
@@ -0,0 +1,34 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("tmp/storage") %>
4
+
5
+ local:
6
+ service: Disk
7
+ root: <%= Rails.root.join("storage") %>
8
+
9
+ # Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
+ # amazon:
11
+ # service: S3
12
+ # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
+ # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
+ # region: us-east-1
15
+ # bucket: your_own_bucket-<%= Rails.env %>
16
+
17
+ # Remember not to checkin your GCS keyfile to a repository
18
+ # google:
19
+ # service: GCS
20
+ # project: your_project
21
+ # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
+ # bucket: your_own_bucket-<%= Rails.env %>
23
+
24
+ # Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
+ # microsoft:
26
+ # service: AzureStorage
27
+ # storage_account_name: your_account_name
28
+ # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
+ # container: your_container_name-<%= Rails.env %>
30
+
31
+ # mirror:
32
+ # service: Mirror
33
+ # primary: local
34
+ # mirrors: [ amazon, google, microsoft ]
File without changes
@@ -0,0 +1,8 @@
1
+ DEPRECATION WARNING: Using legacy connection handling is deprecated. Please set
2
+ `legacy_connection_handling` to `false` in your application.
3
+
4
+ The new connection handling does not support `connection_handlers`
5
+ getter and setter.
6
+
7
+ Read more about how to migrate at: https://guides.rubyonrails.org/active_record_multiple_databases.html#migrate-to-the-new-connection-handling
8
+ (called from require at script/rails:6)
@@ -0,0 +1,23 @@
1
+  (1.0ms) SELECT sqlite_version(*)
2
+ TRANSACTION (0.1ms) begin transaction
3
+ ---------------------------------
4
+ CanHasValidationsTest: test_truth
5
+ ---------------------------------
6
+ TRANSACTION (0.0ms) rollback transaction
7
+  (0.8ms) SELECT sqlite_version(*)
8
+ TRANSACTION (0.1ms) begin transaction
9
+ ---------------------------------
10
+ CanHasValidationsTest: test_truth
11
+ ---------------------------------
12
+ TRANSACTION (0.0ms) rollback transaction
13
+  (0.6ms) SELECT sqlite_version(*)
14
+ TRANSACTION (0.1ms) begin transaction
15
+ ---------------------------------
16
+ CanHasValidationsTest: test_truth
17
+ ---------------------------------
18
+ TRANSACTION (0.0ms) rollback transaction
19
+ TRANSACTION (0.1ms) begin transaction
20
+ ---------------------------------
21
+ CanHasValidationsTest: test_truth
22
+ ---------------------------------
23
+ TRANSACTION (0.0ms) rollback transaction
@@ -0,0 +1 @@
1
+ 4b5a6e34b8d3a11481cda90f33b0c97c64277abf7578bd84874e62006d4892bace067c2bfa3fdfb6e7eaf7290d4f0dc3e32c0018d627a75b1dea7d8271fc51ea
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: can_has_validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thomas morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-20 00:00:00.000000000 Z
11
+ date: 2023-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,6 +30,20 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '7.1'
33
+ - !ruby/object:Gem::Dependency
34
+ name: rake
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: sqlite3
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -58,6 +72,7 @@ files:
58
72
  - lib/can_has_validations.rb
59
73
  - lib/can_has_validations/locale/en.yml
60
74
  - lib/can_has_validations/locale/es.yml
75
+ - lib/can_has_validations/locale/ja.yml
61
76
  - lib/can_has_validations/validators/array_validator.rb
62
77
  - lib/can_has_validations/validators/email_validator.rb
63
78
  - lib/can_has_validations/validators/existence_validator.rb
@@ -79,28 +94,39 @@ files:
79
94
  - test/dummy/app/controllers/application_controller.rb
80
95
  - test/dummy/app/helpers/application_helper.rb
81
96
  - test/dummy/app/views/layouts/application.html.erb
97
+ - test/dummy/bin/rails
98
+ - test/dummy/bin/rake
99
+ - test/dummy/bin/setup
82
100
  - test/dummy/config.ru
83
101
  - test/dummy/config/application.rb
84
102
  - test/dummy/config/boot.rb
103
+ - test/dummy/config/cable.yml
85
104
  - test/dummy/config/database.yml
86
105
  - test/dummy/config/environment.rb
87
106
  - test/dummy/config/environments/development.rb
88
107
  - test/dummy/config/environments/production.rb
89
108
  - test/dummy/config/environments/test.rb
90
109
  - test/dummy/config/initializers/backtrace_silencers.rb
110
+ - test/dummy/config/initializers/content_security_policy.rb
111
+ - test/dummy/config/initializers/filter_parameter_logging.rb
91
112
  - test/dummy/config/initializers/inflections.rb
92
113
  - test/dummy/config/initializers/mime_types.rb
114
+ - test/dummy/config/initializers/permissions_policy.rb
93
115
  - test/dummy/config/initializers/secret_token.rb
94
116
  - test/dummy/config/initializers/session_store.rb
95
117
  - test/dummy/config/initializers/wrap_parameters.rb
96
118
  - test/dummy/config/locales/en.yml
97
119
  - test/dummy/config/routes.rb
120
+ - test/dummy/config/storage.yml
121
+ - test/dummy/db/test.sqlite3
122
+ - test/dummy/log/development.log
98
123
  - test/dummy/log/test.log
99
124
  - test/dummy/public/404.html
100
125
  - test/dummy/public/422.html
101
126
  - test/dummy/public/500.html
102
127
  - test/dummy/public/favicon.ico
103
128
  - test/dummy/script/rails
129
+ - test/dummy/tmp/development_secret.txt
104
130
  - test/test_helper.rb
105
131
  homepage: https://github.com/zarqman/can_has_validations
106
132
  licenses:
@@ -121,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
147
  - !ruby/object:Gem::Version
122
148
  version: '0'
123
149
  requirements: []
124
- rubygems_version: 3.2.22
150
+ rubygems_version: 3.3.26
125
151
  signing_key:
126
152
  specification_version: 4
127
153
  summary: Assorted Rails 5.x-7.x validators
@@ -134,26 +160,37 @@ test_files:
134
160
  - test/dummy/app/controllers/application_controller.rb
135
161
  - test/dummy/app/helpers/application_helper.rb
136
162
  - test/dummy/app/views/layouts/application.html.erb
163
+ - test/dummy/bin/rails
164
+ - test/dummy/bin/rake
165
+ - test/dummy/bin/setup
137
166
  - test/dummy/config/application.rb
138
167
  - test/dummy/config/boot.rb
168
+ - test/dummy/config/cable.yml
139
169
  - test/dummy/config/database.yml
140
170
  - test/dummy/config/environment.rb
141
171
  - test/dummy/config/environments/development.rb
142
172
  - test/dummy/config/environments/production.rb
143
173
  - test/dummy/config/environments/test.rb
144
174
  - test/dummy/config/initializers/backtrace_silencers.rb
175
+ - test/dummy/config/initializers/content_security_policy.rb
176
+ - test/dummy/config/initializers/filter_parameter_logging.rb
145
177
  - test/dummy/config/initializers/inflections.rb
146
178
  - test/dummy/config/initializers/mime_types.rb
179
+ - test/dummy/config/initializers/permissions_policy.rb
147
180
  - test/dummy/config/initializers/secret_token.rb
148
181
  - test/dummy/config/initializers/session_store.rb
149
182
  - test/dummy/config/initializers/wrap_parameters.rb
150
183
  - test/dummy/config/locales/en.yml
151
184
  - test/dummy/config/routes.rb
185
+ - test/dummy/config/storage.yml
152
186
  - test/dummy/config.ru
187
+ - test/dummy/db/test.sqlite3
188
+ - test/dummy/log/development.log
153
189
  - test/dummy/log/test.log
154
190
  - test/dummy/public/404.html
155
191
  - test/dummy/public/422.html
156
192
  - test/dummy/public/500.html
157
193
  - test/dummy/public/favicon.ico
158
194
  - test/dummy/script/rails
195
+ - test/dummy/tmp/development_secret.txt
159
196
  - test/test_helper.rb