7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/generators/devise_invitable/install_generator.rb', line 7
def add_config_options_to_initializer
devise_initializer_path = 'config/initializers/devise.rb'
if File.exist?(devise_initializer_path)
old_content = File.read(devise_initializer_path)
if old_content.match(Regexp.new(/^\s# ==> Configuration for :invitable\n/))
false
else
inject_into_file(devise_initializer_path, before: " # ==> Configuration for :confirmable\n") do
" # ==> Configuration for :invitable\n # The period the generated invitation token is valid.\n # After this period, the invited resource won't be able to accept the invitation.\n # When invite_for is 0 (the default), the invitation won't expire.\n # config.invite_for = 2.weeks\n\n # Number of invitations users can send.\n # - If invitation_limit is nil, there is no limit for invitations, users can\n # send unlimited invitations, invitation_limit column is not used.\n # - If invitation_limit is 0, users can't send invitations by default.\n # - If invitation_limit n > 0, users can send n invitations.\n # You can change invitation_limit column for some users so they can send more\n # or less invitations, even with global invitation_limit = 0\n # Default: nil\n # config.invitation_limit = 5\n\n # The key to be used to check existing users when sending an invitation\n # and the regexp used to test it when validate_on_invite is not set.\n # config.invite_key = { email: /\\\\A[^@]+@[^@]+\\\\z/ }\n # config.invite_key = { email: /\\\\A[^@]+@[^@]+\\\\z/, username: nil }\n\n # Ensure that invited record is valid.\n # The invitation won't be sent if this check fails.\n # Default: false\n # config.validate_on_invite = true\n\n # Resend invitation if user with invited status is invited again\n # Default: true\n # config.resend_invitation = false\n\n # The class name of the inviting model. If this is nil,\n # the #invited_by association is declared to be polymorphic.\n # Default: nil\n # config.invited_by_class_name = 'User'\n\n # The foreign key to the inviting model (if invited_by_class_name is set)\n # Default: :invited_by_id\n # config.invited_by_foreign_key = :invited_by_id\n\n # The column name used for counter_cache column. If this is nil,\n # the #invited_by association is declared without counter_cache.\n # Default: nil\n # config.invited_by_counter_cache = :invitations_count\n\n # Auto-login after the user accepts the invite. If this is false,\n # the user will need to manually log in after accepting the invite.\n # Default: true\n # config.allow_insecure_sign_in_after_accept = false\n\n"
end
end
end
end
|