我的控制器中有以下代码
def create
@employees = Group.find(params[:employee][:group_id]).employees
puts "count!!!!" + @employees.count.to_s
Communicate.deliver_message(params[:subject],@employees,params[:body].to_s)
flash[:notice] = "your message has been sent"
redirect_to root_url
end
以下Communicate
模型中的代码:
def message(sub, people, msg)
#puts "employee count!!!" + people.count
subject sub
bcc "my_email.s@gmail.com"
from 'my_email.s@gmail.com'
sent_on Time.now
body :greeting => msg
end
我得到的错误是create
方法第3行的“错误的参数数量”。
答案 0 :(得分:2)
如果它确实从ActionMailer :: Base继承,则问题是方法的名称:在ActionMailer中使用“message”。需要更改方法名称。