aboutsummaryrefslogtreecommitdiffstats
path: root/lib/patch_mailer_paths.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2012-01-30 13:19:22 +0000
committerSeb Bacon <seb.bacon@gmail.com>2012-01-30 13:19:22 +0000
commit4899ae188f728bfd77b6db950fd5a1e3180c7be8 (patch)
tree45523bfd14cd8479462cf790c987bf63d863edef /lib/patch_mailer_paths.rb
parent7a758a657e10c5b6a11355c9dad205178342096f (diff)
Create stubs for the various points where a user might want to customise Alaveteli via their theme, as per suggestions by @dcabo on [the mailing list](http://groups.google.com/group/alaveteli-dev/msg/f50eba23f75b5c75)
Diffstat (limited to 'lib/patch_mailer_paths.rb')
-rw-r--r--lib/patch_mailer_paths.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/patch_mailer_paths.rb b/lib/patch_mailer_paths.rb
new file mode 100644
index 0000000..d0a0b23
--- /dev/null
+++ b/lib/patch_mailer_paths.rb
@@ -0,0 +1,11 @@
+# Add a callback - to be executed before each request in development,
+# and at startup in production - to patch existing app classes.
+# See http://stackoverflow.com/questions/7072758/plugin-not-reloading-in-development-mode
+#
+require 'dispatcher'
+Dispatcher.to_prepare do
+ # Override mailer templates with theme ones. Note doing this in a before_filter,
+ # as we do with the controller paths, doesn't seem to have any effect when
+ # running in production
+ ActionMailer::Base.view_paths.unshift File.join(File.dirname(__FILE__), "views")
+end