Skip to content

Commit 80b2e7b

Browse files
author
Piotr Kuczynski
committed
Set default overwrite_arrays option to true. Updated documentation
1 parent 3c7b18f commit 80b2e7b

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Changelog
22

3-
## ...
3+
## 1.3.0
44

5+
* **WARNING:** Overwrite arrays found in previously loaded settings file ([#137](https://github.com/railsconfig/config/pull/137) thanks to [@Fryguy](https://github.com/Fryguy) and [@dtaniwaki](https://github.com/dtaniwaki)) - this is a change breaking previous behaviour. If you want to keep Config to work as before, which is merging arrays found in following loaded settings file, please add `config.overwrite_arrays = true` to your Config initializer
56
* Changed default ENV variables loading settings to downcase variable names and parse values
67
* Added parsing ENV variables values to Float type
78
* Change method definition order in Rails integration module to prevent undefined method `preload` error (based on [@YaroSpace](https://github.com/YaroSpace) suggestion in [#111](https://github.com/railsconfig/config/issues/111)

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,7 @@ located at `config/initializers/config.rb`.
253253
### Merge customization
254254

255255
* `knockout_prefix` - ability to remove elements of the array set in earlier loaded settings file. Default: `nil`
256-
257-
* `overwrite_arrays` - ability to replace an entire array set in earlier loaded settings file. Default: `false`
256+
* `overwrite_arrays` - overwrite arrays found in previously loaded settings file. Default: `true`
258257

259258
Check [Deep Merge](https://github.com/danielsdeleo/deep_merge) for more details.
260259

lib/config.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module Config
2222
# deep_merge options
2323
mattr_accessor :knockout_prefix, :overwrite_arrays
2424
@@knockout_prefix = nil
25-
@@overwrite_arrays = false
25+
@@overwrite_arrays = true
2626

2727
def self.setup
2828
yield self if @@_ran_once == false

lib/generators/config/templates/config.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
#
77
# config.knockout_prefix = nil
88

9+
# Overwrite arrays found in previously loaded settings file. When set to `false`, arrays will be merged.
10+
#
11+
# config.overwrite_arrays = true
12+
913
# Load environment variables from the `ENV` object and override any settings defined in files.
1014
#
1115
# config.use_env = false

0 commit comments

Comments
 (0)