Module: Model::UserTagged

Extended by:
ActiveSupport::Concern
Defined in:
app/models/wechat/model/user_tagged.rb

Instance Method Summary collapse

Instance Method Details

#sync_to_wechat_user_tagObject



11
12
13
14
15
16
17
18
19
# File 'app/models/wechat/model/user_tagged.rb', line 11

def sync_to_wechat_user_tag
  user.oauth_users.where(type: 'WechatUser').each do |wechat_user|
    tag = tags.find_by(app_id: wechat_user.app&.id)
    next unless tag

    wut = wechat_user.wechat_user_tags.build(tag_id: tag.id)
    wut.save
  end
end