开发者

how to avoid "wrong number of arguments" in rails

I have following code in my controller

  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 mes开发者_开发百科sage has been sent"
    redirect_to root_url
  end

following code in Communicate model:

  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

Error I am getting is "wrong number of arguments" on 3rd line of the create method.


if it did inherit from ActionMailer::Base, then the problem is the name of the method: "message" is used inside ActionMailer. Need to change the method name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜