site_id로 범위가 지정된 User 모델이 있습니다. 유증 토큰에 의해 초대 된 사용자를 조회하려고하면 내가 초대 링크를 사용하고, 초대 토큰이 사용자를 조회하는 시도를 고안 할 때, 사이트 ID가 Devise 범위가 지정된 사용자 모델이 포함 된 Invitable 초대 토큰
class User < ApplicationRecord
belongs_to :site
default_scope { where(site_id: Site.current_id) }
devise :invitable, :confirmable, :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable
validates_uniqueness_of :email, scope: :site
validates_format_of :email, with: Devise::email_regexp
end
포함되어 있지 않습니다는 사이트 ID는 NULL입니다
SELECT `users`.* FROM `users` WHERE `users`.`site_id` IS NULL AND `users`.`invitation_token` = 'acomplicatedtoken' ORDER BY `users`.`id` ASC LIMIT 1
devise가 User Scope을 인식하도록하려면 어떻게해야합니까?
사용자 모델 내에서'Site.id'를 사용합니다. '사이트'객체에 대해 더 많이 알 수 있습니까? – fossil