为什么我会得到“未定义的方法‘编码’”?我怎样才能解决这个问题?
错误信息
NoMethodError (undefined method `encoding' for #<Array:0x000000218f61e8>):
app/controllers/messages_controller.rb:255:in `deliver'
消息控制器.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
mailers/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