Overloading with nulls #13

Open
davemitchell opened this Issue Feb 24, 2011 · 4 comments

Projects

None yet

4 participants

@davemitchell
davemitchell commented Feb 24, 2011 edited

I was expecting to be able to "unset" a property in an overriding config file. For example, consider the following:

In config/settings.yml
name: Admin
email: root@foo.com

In config/settings/development.yml
name: Nobody
email: null

However, it looks like instead of unsetting the value, the derived property is untouched.
That is, the above case yields:
Settings.name # => Nobody
Settings.email # => root@foo.com

Rather than what I was expecting:
Settings.name # => Nobody
Settings.email # => nil

Bug, or feature?

@tonyla

The reason this is happening is this gem vendor'ed the deep_merge gem

vendor/deep_merge.rb:72
if source.nil? || (!source.is_a?(FalseClass) && source.respond_to?(:blank?) && source.blank?); return dest; end

As you can see it will just skip over any overrides that are false or blank. IMHO this is incorrect and has been fixed in the original gem located here.

https://github.com/danielsdeleo/deep_merge

I just added this dependency to my Gemfile and rails_config will just use the loaded gem instead of the vendored version.

@davemitchell

Cool, thanks!

@pkuczynski pkuczynski added the bug label Mar 31, 2014
@pkuczynski pkuczynski added this to the 0.4 milestone Mar 31, 2014
@toncid

Hello,

What's the status of this issue? It's still occurring and overriding with a blank value doesn't affect the original value.

Thanks!

@pkuczynski pkuczynski modified the milestone: 0.4, 1.3 May 12, 2016
@pkuczynski pkuczynski self-assigned this May 26, 2016
@pkuczynski
railsconfig member

There is an open PR on deep merge gem: danielsdeleo/deep_merge#20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment