diff options
author | azul <azul@riseup.net> | 2013-10-09 11:16:11 -0700 |
---|---|---|
committer | azul <azul@riseup.net> | 2013-10-09 11:16:11 -0700 |
commit | b60a75d8cbe25ac47bb037e9e54a7cf4e2ba4e1f (patch) | |
tree | 0ce1e785c3ceb6ed166f4bd3b4ec5ce4e5658a31 /core/lib | |
parent | 68e056061648be393dc785419fc066ec3d719e58 (diff) | |
parent | 95a5324f12c6f9c44021a93bcd2a45c05bba3f88 (diff) |
Merge pull request #95 from azul/hotfix/4080-couchrest-model-breaks-bundle
Fix couchrest model migrations to work with latest version
Diffstat (limited to 'core/lib')
-rw-r--r-- | core/lib/extensions/couchrest.rb | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/core/lib/extensions/couchrest.rb b/core/lib/extensions/couchrest.rb index 176184f..91dfc1c 100644 --- a/core/lib/extensions/couchrest.rb +++ b/core/lib/extensions/couchrest.rb @@ -42,30 +42,32 @@ module CouchRest end - class Migrate - def self.load_all_models_with_engines - self.load_all_models_without_engines - return unless defined?(Rails) - Dir[Rails.root + 'app/models/**/*.rb'].each do |path| - require path + module Utils + module Migrate + def self.load_all_models_with_engines + self.load_all_models_without_engines + return unless defined?(Rails) + 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 - Dir[Rails.root + '*/app/models/**/*.rb'].each do |path| - require path + + def self.all_models_and_proxies + callbacks = migrate_each_model(find_models) + callbacks += migrate_each_proxying_model(find_proxying_models) + cleanup(callbacks) end - end - def self.all_models_and_proxies - callbacks = migrate_each_model(find_models) - callbacks += migrate_each_proxying_model(find_proxying_models) - cleanup(callbacks) - end + class << self + alias_method_chain :load_all_models, :engines + end - class << self - alias_method_chain :load_all_models, :engines end - end end |