课程发布作业添加到邮件中

This commit is contained in:
huang 2015-06-17 16:25:30 +08:00
parent ed8a134a01
commit cf9455e465
2 changed files with 14 additions and 0 deletions

View File

@ -3,6 +3,7 @@ class HomeworkCommonController < ApplicationController
before_filter :find_course, :only => [:index,:new,:create]
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy]
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment]
after_create :send_mail
def index
homeworks = @course.homework_commons.order("created_at desc")
@ -183,6 +184,10 @@ class HomeworkCommonController < ApplicationController
end
end
def send_mail
Mailer.run.homework_added(self)
end
private
#获取课程
def find_course

View File

@ -517,6 +517,15 @@ class Mailer < ActionMailer::Base
end
end
# Builds a Mail::Message object used to email recipients of a course when an homework are posted.
#
# Example:
# attachments_added(attachments) => Mail::Message object
# Mailer.attachments_added(attachments).deliver => sends an email to the project's recipients
def homework_added
end
# Builds a Mail::Message object used to email recipients of a news' project when a news item is added.
#
# Example: