Skip to content
This repository

Overloading with nulls #13

davemitchell opened this Issue February 24, 2011 · 2 comments

3 participants

dave mitchell Piotr Kuczynski TonyLa
dave mitchell

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

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: # => Nobody # =>

Rather than what I was expecting: # => Nobody # => nil

Bug, or feature?


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

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.

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

dave mitchell

Cool, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.