Permalink
Browse files

Rails::Railtie subclass (Rails 3)

  • Loading branch information...
1 parent 9f09c56 commit 09ca228aa319c844f743b34221c5d1fe60146f14 @kawamanza kawamanza committed Mar 15, 2012
Showing with 10 additions and 5 deletions.
  1. +1 −0 lib/purgeable.rb
  2. +9 −0 lib/purgeable/railtie.rb
  3. +0 −5 lib/purgeable/settings.rb
View
@@ -6,3 +6,4 @@ module Purgeable
require "purgeable/http/purge"
require "purgeable/settings"
+require "purgeable/railtie" if defined?(::Rails) && defined?(::Rails::Railtie)
View
@@ -0,0 +1,9 @@
+# encoding: UTF-8
+module Purgeable
+ class Railtie < ::Rails::Railtie
+ initializer "setup http cache" do
+ config_file = ::Rails.root.join("config/purgeable.yml")
+ Purgeable.load_settings config_file, ::Rails.env if File.exists? config_file
+ end
+ end
+end
@@ -16,9 +16,4 @@ def self.load_settings file_path, env
end
end
end
-
- if defined? ::Rails
- config_file = ::Rails.root.join("config/purgeable.yml")
- load_settings config_file, ::Rails.env if File.exists? config_file
- end
end

0 comments on commit 09ca228

Please sign in to comment.