soveran / cuba

Rum based microframework for web development.
http://cuba.is
MIT License
1.44k stars 249 forks source link

Attempt to look up non-existing settings in parent classes (see #21) #55

Open britishtea opened 9 years ago

britishtea commented 9 years ago

This fixes an issue where settings are added to Cuba.settings after inheriting from Cuba are not picked up by the child classes. The problem is described in issue #21.

If a setting does not exist, settings are looked up in the settings Hash of the parent class using Hash#default_proc. The settings Hash is still deepcloned, so settings are still overridable.

mkristian commented 8 years ago

I personally solved this issue without deep cloning via Marshal since have two problems with Marshal

I am using this cuba-plugin https://github.com/mkristian/cuba-api/blob/master/lib/cuba_api/config.rb which replaces Cuba.settings['x'] with Cuba['x'] which behaves like settings but fixes the two above problems. sorry that I never attempt to bring this in as PR to cuba itself.

soveran commented 8 years ago

I added a comment, please let me know what you guys think: https://github.com/soveran/cuba/issues/21#issuecomment-171940039