app/models/notifier.rb
# Initialize the mailer via the given +method_name+. The body will be
# rendered and a new TMail::Mail object created.
Initialize the mailer via the given +method_name+. The body will be
rendered and a new TMail::Mail object created.
Initialize the mailer via the given + method_name + . The body will be rendered and a new TMail :: Mail object created .
def create!(method_name, *parameters) 
            initialize_defaults(method_name)
            __send__(method_name, *parameters)
            unless String === @body
                if @parts.empty?
                    Dir.glob("#{template_path}/#{@template}.*").each do |path|
                        template = template_root["#{mailer_name}/#{File.basename(path)}"]
                        next unless template && template.multipart?
                        @parts << Part.new(
                                           :content_type => template.content_type,
                                           :disposition => "inline",
                                           :charset => charset,
                                           :body => render_message(template, @body)
                                           )
                    end
                    unless @parts.empty?
                        unless @content_type =~ /^multipart/
                            @content_type = "multipart/alternative"
                        end
                        @parts = sort_parts(@parts, @implicit_parts_order)
                    end
                end
                template_exists = @parts.empty?
                template_exists ||= template_root["#{mailer_name}/#{@template}"]
                @body = render_message(@template, @body) if template_exists
                if !@parts.empty? && String === @body
                    @parts.unshift Part.new(:charset => charset, :body => @body)
                    @body = nil
                end
            end
            @mime_version ||= "1.0" if !@parts.empty?
            @mail = create_mail
        end
def create! ( method_name , * parameters ) initialize_defaults ( method_name ) __send__ ( method_name , * parameters ) unless String === @body if @parts . empty? Dir . glob ( "#{template_path}/#{@template}.*" ) . each do | path | template = template_root [ "#{mailer_name}/#{File.basename(path)}" ] next unless template && template . multipart? @parts << Part . new ( :content_type => template . content_type , :disposition => "inline" , :charset => charset , :body => render_message ( template , @body ) ) end unless @parts . empty? unless @content_type =~ / ^multipart / @content_type = "multipart/alternative" end @parts = sort_parts ( @parts , @implicit_parts_order ) end end template_exists = @parts . empty? template_exists ||= template_root [ "#{mailer_name}/#{@template}" ] @body = render_message ( @template , @body ) if template_exists if ! @parts . empty? && String === @body @parts . unshift Part . new ( :charset => charset , :body => @body ) @body = nil end end @mime_version ||= "1.0" if ! @parts . empty? @mail = create_mail end
Initialize the mailer via the given +method_name+.
Initialize the mailer via the given + method_name + .
#:nodoc: # If an explicit, textual body has not been set, we check assumptions. # First, we look to see if there are any likely templates that match, # which include the content-type in their file name (i.e., # "the_template_file.text.html.erb", etc.). Only do this if parts # have not already been specified manually. # Skip unless template has a multipart format # Then, if there were such templates, we check to see if we ought to # also render a "normal" template (without the content type). If a # normal template exists (or if there were no implicit parts) we render # it. # Finally, if there are other message parts and a textual body exists, # we shift it onto the front of the parts and set the body to nil (so # that create_mail doesn't try to render it in addition to the parts). # If this is a multipart e-mail add the mime_version if it is not # already set. # build the mail object itself
method_name
<not_specific>
parameters
<not_specific>