invitation 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab564f2a4d0c69e751b7792ce13377f59b99b439
4
- data.tar.gz: 19bee13eb29a9041b6afe38e1dc6c162e9559b8c
3
+ metadata.gz: d31c41d437dc46e7d2b4c95b27fef37fbcb8efc0
4
+ data.tar.gz: 22ec9ef308cd58df3e518c9d26da2250382db666
5
5
  SHA512:
6
- metadata.gz: e91e724acd4e5f2294c94af74aab19ad3d350db8cb436b8455c5ee578fe4ce47b838a0fb2ffc9dda2a584fe8a5e9cde351fe82a3c44f48117ed9b7fe3ad93d16
7
- data.tar.gz: 7b5d05aeb33f61cf0de81f0d445185fab4083e2194a3c776939392701d136f13ac66be5ba736caa9ed80dd63b3754c794c9f4c7959ab51e8a009944b86b92b6d
6
+ metadata.gz: 6b2f75b71f9aef28f0f0ae5afe71a0b56faa8f9abfcdf472b475ce2c18b7892699b40f5a270f8ff8e9f262bbbcec0172facf1ff78ded8d0ddefd368a8c7fe09c
7
+ data.tar.gz: e268b4a3d4eb4d8702f11ee18b5109d73bfb152cb7e60d607aef0c76a96e32cc57985f3e79d5267d98908688159cf2797881bbef60fef7efac227e45eaaaedc2
@@ -8,9 +8,18 @@ module Invitation
8
8
  # end
9
9
  #
10
10
  class Configuration
11
- # ActiveRecord model class name that represents your user.
11
+ # Name of the ActiveRecord class that represents users in your application.
12
+ #
13
+ # Example:
14
+ # Invitation.configure do |config|
15
+ # config.user_model = 'User'
16
+ # end
17
+ #
18
+ # DEPRECATED: can be set to the user class (not it's name), e.g. `config.user_model = User`.
19
+ # Support for setting the class directly may be removed in a future update.
12
20
  #
13
21
  # Defaults to '::User'.
22
+ #
14
23
  # @return [ActiveRecord::Base]
15
24
  attr_accessor :user_model
16
25
 
@@ -61,8 +70,28 @@ module Invitation
61
70
  @case_sensitive_email = true
62
71
  end
63
72
 
73
+ # @return [Class]
64
74
  def user_model
65
- @user_model.constantize
75
+ if !@user_model.respond_to?(:constantize) && @user_model_class.nil?
76
+ warn <<-EOM.squish
77
+ Invitation's `user_model` configuration setting should now be set to a string
78
+ specifying the user model's class name.
79
+
80
+ Future versions of Invitation will no longer support setting user_model to a class.
81
+
82
+ It is recommended that you opt-in now and set your user model to a class name.
83
+ Example:
84
+ Invitation.configure do |config|
85
+ config.user_model = 'User'
86
+ end
87
+ EOM
88
+ end
89
+ @user_model_class ||=
90
+ if @user_model.respond_to?(:constantize)
91
+ @user_model.constantize
92
+ else
93
+ @user_model
94
+ end
66
95
  end
67
96
 
68
97
  def user_model_class_name
@@ -1,3 +1,3 @@
1
1
  module Invitation
2
- VERSION = '0.4.2'.freeze
2
+ VERSION = '0.4.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: invitation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Tomich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-02 00:00:00.000000000 Z
11
+ date: 2017-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails