lib/layouts.rb
def render_layout_template(template, method_name, layout_path = File.join('layouts', 'mailers'))
        extension_parts = method_name.split('.')[1..-1]
        while !extension_parts.blank?
          file_name = File.join(layout_path, ([@layout.to_s] + extension_parts).join('.'))
          return render_layout(file_name, template) if template_exists?(file_name)
          extension_parts.shift
        end
        # nothing found, complain
        raise "Layout '#{@layout}' not found"
      end
# finds the layout file and renders it, if the file is not found an exception is raised
# default path for all mailer layouts is layouts/mailers below app/views/
# you can pass in another layout path as 3rd arguments
finds the layout file and renders it, if the file is not found an exception is raised
default path for all mailer layouts is layouts/mailers below app/views
you can pass in another layout path as 3rd arguments
finds the layout file and renders it if the file is not found an exception is raised default path for all mailer layouts is layouts / mailers below app / views you can pass in another layout path as 3rd arguments
def render_layout_template(template, method_name, layout_path = File.join('layouts', 'mailers'))
        extension_parts = method_name.split('.')[1..-1]
        while !extension_parts.blank?
          file_name = File.join(layout_path, ([@layout.to_s] + extension_parts).join('.'))
          return render_layout(file_name, template) if template_exists?(file_name)
          extension_parts.shift
        end
        raise "Layout '#{@layout}' not found"
      end
def render_layout_template ( template , method_name , layout_path = File . join ( 'layouts' , 'mailers' ) ) extension_parts = method_name . split ( '.' ) [ 1 .. - 1 ] while ! extension_parts . blank? file_name = File . join ( layout_path , ( [ @layout . to_s ] + extension_parts ) . join ( '.' ) ) return render_layout ( file_name , template ) if template_exists? ( file_name ) extension_parts . shift end raise "Layout '#{@layout}' not found" end
finds the layout file and renders it, if the file is not found an exception is raised
default path for all mailer layouts is layouts/mailers below app/views
you can pass in another layout path as 3rd arguments
finds the layout file and renders it if the file is not found an exception is raised default path for all mailer layouts is layouts / mailers below app / views you can pass in another layout path as 3rd arguments
# nothing found, complain
template
method_name
layout_path
join