Browse files

For Rails 2.3, we don't need to explicitly load our app path-based cl…

  • Loading branch information...
1 parent d198329 commit f15805a5ebaa44ff18f4d0bd48f9c0ba1629ca92 @mattenat mattenat committed Apr 7, 2009
Showing with 12 additions and 3 deletions.
  1. +12 −3 init.rb
15 init.rb
@@ -1,6 +1,15 @@
require 'deliver_later'
ActionMailer::Base.send :include, DeliverLater
-models = File.join(File.dirname(__FILE__), 'app', 'models')
-$LOAD_PATH << models
-Dependencies.load_paths << models
+# check that we're rails-2.3 and that we're loading app paths via the
+# Rails::Plugin loader process. if both of those things are true, we
+# don't need to do any more shenanigans to get deviler_later loaded.
+# note: this isn't fantastic, specifically checking to see if a
+# private method exists in light of the fact the api could change, but
+# it is a pretty good check to see if we'll need to do additional
+# loading
+unless ActiveSupport.const_defined?(:Dependencies) && Rails.const_defined?(:Plugin) && Rails::Plugin.private_instance_methods.include?("app_paths")
+ models = File.join(File.dirname(__FILE__), 'app', 'models')
+ $LOAD_PATH << models
+ Dependencies.load_paths << models

0 comments on commit f15805a

Please sign in to comment.