aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2012-06-12 09:16:55 +0100
committerSeb Bacon <seb.bacon@gmail.com>2012-06-12 09:16:55 +0100
commit1068327d89d75ff840b554a1670468f80ba98cab (patch)
tree9acadffc26973fa811b6f81d9223426c6905b603
parentaef8f2598f100ca795091133b921cc9e9759cc39 (diff)
Create and use a dynamically-named filter path for the theme, so we can ensure multiple themes don't overwrite each other.
-rw-r--r--lib/alavetelitheme.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/alavetelitheme.rb b/lib/alavetelitheme.rb
index b4f93a5..d3998b2 100644
--- a/lib/alavetelitheme.rb
+++ b/lib/alavetelitheme.rb
@@ -1,7 +1,11 @@
class ActionController::Base
- before_filter :set_view_paths
-
- def set_view_paths
+ # The following prepends the path of the current theme's views to
+ # the "filter_path" that Rails searches when deciding which
+ # template to use for a view. It does so by creating a method
+ # uniquely named for this theme.
+ path_function_name = "set_view_paths_for_#{THEME_NAME}"
+ before_filter path_function_name.to_sym
+ send :define_method, path_function_name do
self.prepend_view_path File.join(File.dirname(__FILE__), "views")
end
end