Skip to content

Commit 5bfcc77

Browse files
bradleypriestscambra
authored andcommitted
Look up invited_by_class_name on the current model rather than the global config, this allows multiple invitable models with different configs.
1 parent 12b5f08 commit 5bfcc77

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/devise_invitable/models.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ module Invitable
3030

3131
included do
3232
include ::DeviseInvitable::Inviter
33-
belongs_to_options = if Devise.invited_by_class_name
34-
{ class_name: Devise.invited_by_class_name }
33+
belongs_to_options = if invited_by_class_name
34+
{ class_name: invited_by_class_name }
3535
else
3636
{ polymorphic: true }
3737
end
@@ -78,7 +78,7 @@ def self.required_fields(klass)
7878
fields = [:invitation_token, :invitation_created_at, :invitation_sent_at, :invitation_accepted_at,
7979
:invitation_limit, Devise.invited_by_foreign_key || :invited_by_id, :invited_by_type]
8080
fields << :invitations_count if defined?(ActiveRecord) && self < ActiveRecord::Base
81-
fields -= [:invited_by_type] if Devise.invited_by_class_name
81+
fields -= [:invited_by_type] if invited_by_class_name
8282
fields
8383
end
8484

0 commit comments

Comments
 (0)