-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
accept a string for configuration.user_model and constantize it in an…
… accessor fix #8
- Loading branch information
itkin
committed
Jun 27, 2017
1 parent
4569c1c
commit 2aa41f9
Showing
4 changed files
with
11 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Invitation.configure do |config| | ||
# config.user_model = ::User | ||
# config.user_model = '::User' | ||
# config.user_registration_url = ->(params) { Rails.application.routes.url_helpers.sign_up_url(params) } | ||
# config.mailer_sender = '[email protected]' | ||
# config.routes = true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,19 +54,23 @@ class Configuration | |
attr_accessor :case_sensitive_email | ||
|
||
def initialize | ||
@user_model = ::User if defined?(::User) | ||
@user_model = '::User' #if defined?(::User) | ||
@user_registration_url = ->(params) { Rails.application.routes.url_helpers.sign_up_url(params) } | ||
@mailer_sender = '[email protected]' | ||
@routes = true | ||
@case_sensitive_email = true | ||
end | ||
|
||
def user_model | ||
@user_model.constantize | ||
end | ||
|
||
def user_model_class_name | ||
@user_model.name.to_s | ||
user_model.name.to_s | ||
end | ||
|
||
def user_model_instance_var | ||
'@' + @user_model.name.demodulize.underscore | ||
'@' + user_model.name.demodulize.underscore | ||
end | ||
|
||
# @return [Boolean] are Invitation's built-in routes enabled? | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Invitation.configure do |config| | ||
config.user_model = User | ||
config.user_model = 'User' | ||
config.user_registration_url = ->(params) { 'this_is_a_fake_user_registration_url' } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters