summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/config/initializers/load_config.rb7
-rw-r--r--core/lib/extensions/couchrest.rb5
2 files changed, 11 insertions, 1 deletions
diff --git a/core/config/initializers/load_config.rb b/core/config/initializers/load_config.rb
new file mode 100644
index 0000000..b2b0318
--- /dev/null
+++ b/core/config/initializers/load_config.rb
@@ -0,0 +1,7 @@
+def load_config_file(file)
+ File.exists?(file) ? YAML.load_file(file)[Rails.env] : {}
+end
+
+defaults = load_config_file("#{Rails.root}/config/defaults.yml") || {}
+config = load_config_file("#{Rails.root}/config/config.yml") || {}
+APP_CONFIG = defaults.merge(config).with_indifferent_access
diff --git a/core/lib/extensions/couchrest.rb b/core/lib/extensions/couchrest.rb
index f203426..176184f 100644
--- a/core/lib/extensions/couchrest.rb
+++ b/core/lib/extensions/couchrest.rb
@@ -46,7 +46,10 @@ module CouchRest
def self.load_all_models_with_engines
self.load_all_models_without_engines
return unless defined?(Rails)
- Dir[Rails.root + '**/models/**/*.rb'].each do |path|
+ Dir[Rails.root + 'app/models/**/*.rb'].each do |path|
+ require path
+ end
+ Dir[Rails.root + '*/app/models/**/*.rb'].each do |path|
require path
end
end