Ticket #215: aaf_init.patch
| File aaf_init.patch, 2.2 kB (added by aaf, 6 months ago) |
|---|
-
acts_as_ferret/init.rb
old new 20 20 21 21 require 'acts_as_ferret' 22 22 23 config.after_initialize { ActsAsFerret::load_config } 24 config.to_prepare { ActsAsFerret::load_config } -
acts_as_ferret/lib/acts_as_ferret.rb
old new 46 46 47 47 require 'ferret_server' 48 48 49 require 'aaf_loader'50 49 require 'rdig_adapter' 51 50 52 51 # The Rails ActiveRecord Ferret Mixin. … … 248 247 return index 249 248 end 250 249 251 # call this in environment.rb in case you use external index declarations in252 # config/aaf.rb:253 #254 # Rails::Initializer.run do |config|255 # ...256 # config.after_initialize do257 # ActsAsFerret::initialize258 # end259 # end260 #261 def self.initialize262 load_config263 # let the application reload the aaf config on each request so aaf stays264 # active even when classes are reloaded in dev mode.265 if RAILS_ENV == 'development'266 ActionController::Base.send :include, ActsAsFerret::AafLoader267 end268 end269 270 250 def self.load_config 271 # using require_dependency to make the reloading in dev mode via AafLoader working.251 # using require_dependency to make the reloading in dev mode work. 272 252 require_dependency "#{RAILS_ROOT}/config/aaf.rb" 273 253 ActsAsFerret::logger.info "loaded configuration file aaf.rb" 274 254 rescue LoadError -
/dev/null
old new 1 # Helper to avoid class reloading issues when using shared index declarations2 # outside of model classes (RAILS_ROOT/config/aaf.rb).3 #4 # Include this module in your ApplicationController to make sure your5 # config/aaf.rb gets reloaded on every request in development mode.6 #7 module ActsAsFerret8 module AafLoader9 def self.included(target)10 target.before_filter :load_aaf_config11 end12 13 def load_aaf_config14 ActsAsFerret::load_config15 end16 end17 end
