「undefined method `encoding'」と表示されるのはなぜですか? どうすればこれを修正できますか?
エラーメッセージ
NoMethodError (undefined method `encoding' for #<Array:0x000000218f61e8>):
app/controllers/messages_controller.rb:255:in `deliver'
messages_controller.rb
# coding: UTF-8
class MessagesController < ApplicationController
deliver
users = User.confirmed.order("created_at ASC")
@users_emails = []
users.each do |user|
@users_emails += [user.email]
end
subject = params[:messages][:subject]
body = params[:messages][:body]
CallMailer.call_email(@users_emails, subject, body).deliver <= This is line 255
end
end
メーラー/call_mailer.rb
# coding: UTF-8
class CallMailer < ActionMailer::Base
default :from => "dont-reply@example.com"
def call_email(users_emails, mesesage_subject, mesesage_body)
@users_emails = users_emails
@mesesage_subject = mesesage_subject
@mesesage_body = mesesage_body
mail(
:bcc => @users_emails,
:subject => @mesesage_subject,
:body => @mesesage_body) do |format|
format.html
end
end
end