0

应用程序/服务/mail_service

class MailService
 def subscribe
  code
 end 
end

用户模型

class User < ActiveRecord::Base
 after_create :user_subscribe
 def user_subscribe
    Services::MailService.new
 end
end

它显示错误,例如uninitialized constant Services

4

2 回答 2

0

您不必编写服务只需编写:-

MailService.new
于 2013-10-17T06:11:11.083 回答
0

尝试这个

require 'MailService.rb'
class User < ActiveRecord::Base
 after_create :user_subscribe
 def user_subscribe
    MailService.new
 end
end
于 2013-10-17T06:13:11.110 回答