0
未定義的方法`拆分'爲零:NilClass發送郵件時,在分段上。未定義的方法`拆分'爲零:NilClass發送郵件時,在分期上
NoMethodError:未定義的方法`分裂」的零:NilClass
有沒有人經歷過這樣的錯誤?在開發環境中,字母完美
21 File "/var/www/vectoring-staging/releases/20140505020949/app/models/feedback.rb" line 11 in deliver
22 File "/var/www/vectoring-staging/releases/20140505020949/app/controllers/feedbacks_controller.rb" line 4 in "createp/controllers/feedbacks_controller.rb" line 4 in create
class FeedbacksController < ApplicationController
def create
@feedback = Feedback.new(params[:feedback])
@feedback.deliver if @feedback.valid?
end
end
class Feedback
include ActiveModel::Model
attr_accessor :email, :message
attr_writer :subject
validates :message, presence: true, allow_blank: false
validates_format_of :email, with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, allow_blank: true
def deliver
FeedbackMailer.new_feedback(self).deliver
end
def subject
@subject = 'A new feedback' if @subject.blank?
@subject
end
end
class FeedbackMailer < ActionMailer::Base
layout 'email'
def new_feedback(feedback)
@message = feedback.message
mail(to: APP_CONFIG.feedback['to_send'], subject: feedback.subject, reply_to: feedback.email)
end
end
你正在調用'.split'的方法在哪裏? –
你能發佈完整的錯誤信息嗎? –
@WaliAli就是這樣,我從來沒有稱過'split'。 – user3458697