app/models/unidom/contact/concerns/as_subscriber.rb in unidom-contact-1.3.4 vs app/models/unidom/contact/concerns/as_subscriber.rb in unidom-contact-1.3.5
- old
+ new
@@ -1,12 +1,18 @@
+##
+# As Subscriber 是联系人的领域逻辑关注点。
+
module Unidom::Contact::Concerns::AsSubscriber
extend ActiveSupport::Concern
included do |includer|
has_many :contact_subscriptions, class_name: 'Unidom::Contact::ContactSubscription', as: :subscriber
+ ##
+ # 将当前参与者与指定的联系方式 contact 关联起来。 at 是关联时间,缺省为当前时间。 name 是联系方式的备注。 primary 是主要联系标志。
+ # 如: current_person.subscribe_contact! phone_number, at: Time.now, name: '私人手机号码', primary: true
def subscribe_contact!(contact, at: Time.now, name: nil, primary: true)
raise ArgumentError.new('The contact argument is required.') if contact.blank?
raise ArgumentError.new('The at argument is required.' ) if at.blank?