• E
    Introduce InvalidConfigurationError · dde03a92
    eileencodes 提交于
    In our app at work we had a faked config like this:
    
    ```
    { "foo" => :bar, "bar" => { "adapter" => "memory" } }
    ```
    
    This config is invalid. You can't say for foo env just have a symbol,
    nor would this work if you had fa foo env with just a string. A
    configuration must be a url or an adapter or a database. Otherwise it's
    invalid and we can't parse it.
    
    When this was just yaml turned into hashes you could get away with
    passing whatever. It wouldn't work but it wouldn't blow up either.
    
    Now that we're using objects we were returning `nil` for these but that
    just means we either blow up on `for_current_env` or compact the
    `nil`'s.
    
    I think it's a better user experience to not build the configs and raise
    an appropriate error.
    
    This is also an invalid config because if you do pass a string here it
    should be a URL.
    
    ```
    { "foo" => "bar", "bar" => { "adapter" => "memory" } }
    ```
    dde03a92
database_configurations.rb 8.2 KB