Permalink
Browse files

joemoore -- made the action_mailer changes backwards-compatible with …

…older versions of Rails
  • Loading branch information...
pivotal
pivotal committed Aug 26, 2009
1 parent 65b4991 commit b7580f138ab9a18906d62e93b8e027d3380f5380
@@ -4,7 +4,10 @@
require "#{dir}/plugin_templates/1.2.0/action_mailer"
elsif Desert::VersionChecker.rails_version_is_below_rc2?
require "#{dir}/plugin_templates/1.99.0/action_mailer"
-else
+elsif Desert::VersionChecker.rails_version_is_below_220?
require "#{dir}/plugin_templates/2.0.0/action_mailer"
+else
+ require "#{dir}/plugin_templates/2.2.0/action_mailer"
end
+
require "#{dir}/plugin_templates/action_view"
@@ -1,3 +1,4 @@
+p 'loading old'
module ActionMailer #:nodoc
class Base #:nodoc:
private
@@ -11,9 +12,9 @@ def template_path_with_plugin_routing
alias_method_chain :template_path, :plugin_routing
def initialize_template_class(assigns)
- self.view_paths = Dir[template_path].collect do |path|
+ view_paths = Dir[template_path].collect do |path|
File.dirname(path)
- end if self.view_paths.empty?
+ end
returning(template = ActionView::Base.new(view_paths, assigns, self)) do
template.extend ApplicationHelper
template.extend self.class.master_helper_module
@@ -21,6 +21,10 @@ def rails_version_is_below_rc2?
def rails_version_is_1991?
current_rails_version_matches?('=1.99.1')
end
+
+ def rails_version_is_below_220?
+ current_rails_version_matches?('<2.2.0')
+ end
end
end
end

0 comments on commit b7580f1

Please sign in to comment.