lib/ehcache/active_support_store.rb in jruby-ehcache-rails2-1.2.0 vs lib/ehcache/active_support_store.rb in jruby-ehcache-rails2-1.3.0
- old
+ new
@@ -42,6 +42,17 @@
at_exit do
@cache_manager.shutdown if @cache_manager
end
end
-end
\ No newline at end of file
+end
+
+if defined?(Rails)
+ Ehcache::ActiveSupportStore.default_cache_name = 'rails_cache'
+
+ case Rails::VERSION::MAJOR
+ when 2
+ Ehcache::ActiveSupportStore.config_directory = File.expand_path(File.join(RAILS_ROOT, 'config'))
+ when 3
+ Ehcache::ActiveSupportStore.config_directory = File.expand_path(File.join(::Rails.root, 'config'))
+ end
+end