mailer wrong number of arguments

11 views
Skip to first unread message

fugee ohu

unread,
May 30, 2018, 11:03:29 AM5/30/18
to Ruby on Rails: Talk
controller by POST from form with inputs for 'subject' and 'message' (message is the body)
  def mail_to_confirmed_users0 @message=params[:message] subject=params[:subject] User.where("confirmed_at is not null").each do |user| AdminGeneralMailer.mail_to_confirmed_users(user: user, subject: subject, message: @message).deliver_now end end
mailer:

  def mail_to_confirmed_users
    @user=params[:user]
    @subject=params[:subject]
    @message=params[:message]
    mail(to: @user.email, subject: @subject)
  end



Colin Law

unread,
May 30, 2018, 11:56:34 AM5/30/18
to Ruby on Rails: Talk
And the full error message is?

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/46ab16a4-553f-4337-82a0-9dcd5a0ad307%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted
Message has been deleted

fugee ohu

unread,
May 30, 2018, 11:39:07 PM5/30/18
to Ruby on Rails: Talk


On Wednesday, May 30, 2018 at 11:56:34 AM UTC-4, Colin Law wrote:
On 30 May 2018 at 16:03, fugee ohu <fuge...@gmail.com> wrote:
controller by POST from form with inputs for 'subject' and 'message' (message is the body)
  def mail_to_confirmed_users0 @message=params[:message] subject=params[:subject] User.where("confirmed_at is not null").each do |user| AdminGeneralMailer.mail_to_confirmed_users(user: user, subject: subject, message: @message).deliver_now end end
mailer:

  def mail_to_confirmed_users
    @user=params[:user]
    @subject=params[:subject]
    @message=params[:message]
    mail(to: @user.email, subject: @subject)
  end


And the full error message is?

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.


I just needed to pass a sequence of arguments in the call to the mailer from  controller and match them with same sequence in parentheses next to my mailer action's definition If you know what I mean =D
Reply all
Reply to author
Forward
0 new messages