应用程序/服务/ 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
答案 0 :(得分:0)
你不必写服务只写: -
MailService.new
答案 1 :(得分:0)
试试这个
require 'MailService.rb'
class User < ActiveRecord::Base
after_create :user_subscribe
def user_subscribe
MailService.new
end
end