Ruby on Rails Wednesday, May 30, 2018



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.
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.
ArgumentError in AdminController#mail_to_confirmed_users0
wrong number of arguments (given 1, expected 0)

Extracted source (around line #11):
9
10
11
12
13
14
              
  end

  def mail_to_confirmed_users
    @user=params[:user]
    @subject=params[:subject]
    @message=params[:message]


Application Trace | Framework Trace | Full Trace
app/mailers/admin_general_mailer.rb:11:in `mail_to_confirmed_users'
app/controllers/admin_controller.rb:58:in `block in mail_to_confirmed_users0'
app/controllers/admin_controller.rb:57:in `mail_to_confirmed_users0'
Request

Parameters:

{"utf8"=>"✓", "authenticity_token"=>"cLixKnAczVvcETk/R+16X4VyiNM2oFOTlbst/k4gOzQLoX01g330NMUC3jAgMWHVAtCjog==", "subject"=>"123", "message"=>"456", "commit"=>"Submit"}
Toggle session dump
Toggle env dump
Response

Headers:

None

 

--
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/b7a1454f-828b-432f-955d-0a2351216d12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment