dynamic-active-model 0.16.0 → 1.0.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: 6e8e20f58fe5d7cae0b4c699388d39ba803f2a4bcf69f46cf4e38ce1ca0df8fd
4
- data.tar.gz: 0c6a79166d4d62c99d61450883296aee87531f9d2e854bc71cf08587e130c881
3
+ metadata.gz: 471bcb2966f59d8f8f4f7df9f32432cf6ff215685a770e2a99956844e0f2d8d5
4
+ data.tar.gz: 69941d0598425aaf866cfdc29a6e8252d38df291d61523e6edae6243d7f049c0
5
5
  SHA512:
6
- metadata.gz: 63cac3e28e12282b2dce7821ed2436ae1092df5622f8ba401ba709f4161d500837ae75a62ef2d76eff65dd56d4d57a2b95b282a05de59e7bab63e4be83deb5cf
7
- data.tar.gz: 978019763203fa5d993c2efff7f1102862707db324649649edbc8aa2a7556e8aa8a7befb3ed2fefebf86f4babcf4db54b852df5a8fa8cb13f9e7c092e0a84cff
6
+ metadata.gz: a7b6cd8138519d8879df5fab6349771b2cc586d340752d566431a985aac152f102c10654dd60098695f303f3fd35eec5b85f109d269ac24a489b51de0a6f2e05
7
+ data.tar.gz: 3402b23d14abd1b92525642021a5586a202d83aa09683cfe14ae576d9ead974fdccd72374bb7d4f47b77ffc56ca4ba8c8fbb48f3c8cdc371ba283b2f15f24a9f
@@ -63,11 +63,12 @@ module DynamicActiveModel
63
63
 
64
64
  # Sets or gets the database connection options
65
65
  # @param options [Hash, Symbol, String, nil] Anything establish_connection accepts:
66
- # a config hash, or a Symbol naming a database.yml entry for the current
67
- # environment. A String database.yml name is deprecated.
68
- # @return [Hash, Symbol] The current connection options
66
+ # a config hash, a URL, or a Symbol naming a database.yml entry for the
67
+ # current environment
68
+ # @return [Hash, Symbol, String] The current connection options
69
+ # @raise [ArgumentError] For a database.yml name given as a String
69
70
  def connection_options(options = nil)
70
- options = deprecated_named_configuration(options) if options.is_a?(String)
71
+ reject_database_yml_name!(options) if options.is_a?(String)
71
72
 
72
73
  update_config(:connection_options, options) if options
73
74
 
@@ -173,17 +174,16 @@ module DynamicActiveModel
173
174
 
174
175
  private
175
176
 
176
- # Resolves a database.yml name given as a String, warning that it's deprecated
177
- # @param name [String]
178
- # @return [Hash] The named configuration for the current Rails environment
179
- def deprecated_named_configuration(name)
180
- DynamicActiveModel.deprecator.warn(
181
- "connection_options with a database.yml name as a String (#{name.inspect}) is deprecated; " \
182
- "pass a Symbol instead (connection_options #{name.to_sym.inspect}), " \
183
- 'or use dynamic-active-model-rails in a Rails app',
184
- caller_locations(2) # point at the caller of connection_options
185
- )
186
- ActiveRecord::Base.configurations.configs_for(env_name: ::Rails.env, name: name).configuration_hash
177
+ # A String database.yml name was deprecated in 0.16 and removed in 1.0. Without
178
+ # this check it would reach establish_connection as a URL and fail confusingly.
179
+ # @param options [String]
180
+ # @raise [ArgumentError] Unless the String is a URL
181
+ def reject_database_yml_name!(options)
182
+ return if options.include?('://')
183
+
184
+ raise ArgumentError,
185
+ "connection_options no longer accepts a database.yml name as a String (#{options.inspect}); " \
186
+ "pass a Symbol instead (connection_options #{options.to_sym.inspect})"
187
187
  end
188
188
 
189
189
  # Stores a single configuration value
@@ -2,5 +2,5 @@
2
2
 
3
3
  module DynamicActiveModel
4
4
  # Gem version, bumped by release-please
5
- VERSION = '0.16.0'
5
+ VERSION = '1.0.0'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamic-active-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '4'
18
+ version: '7.1'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: '4'
25
+ version: '7.1'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: inheritance-helper
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -71,7 +71,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: '3.0'
74
+ version: '3.2'
75
75
  required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  requirements:
77
77
  - - ">="