omniauth-identity 3.0.3 → 3.0.8
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 +4 -4
- data/CHANGELOG.md +69 -0
- data/README.md +94 -12
- data/lib/omniauth-identity/version.rb +1 -1
- data/lib/omniauth/identity.rb +2 -1
- data/lib/omniauth/identity/model.rb +92 -29
- data/lib/omniauth/identity/models/active_record.rb +2 -2
- data/lib/omniauth/identity/models/couch_potato.rb +6 -0
- data/lib/omniauth/identity/models/mongoid.rb +1 -0
- data/lib/omniauth/identity/models/{no_brainer.rb → nobrainer.rb} +1 -0
- data/lib/omniauth/identity/models/sequel.rb +48 -0
- data/lib/omniauth/identity/secure_password.rb +98 -37
- data/lib/omniauth/strategies/identity.rb +47 -23
- data/spec/omniauth/identity/model_spec.rb +19 -99
- data/spec/omniauth/identity/models/active_record_spec.rb +19 -10
- data/spec/omniauth/identity/models/sequel_spec.rb +38 -0
- data/spec/omniauth/strategies/identity_spec.rb +123 -5
- data/spec/spec_helper.rb +16 -4
- data/spec/support/shared_contexts/instance_with_instance_methods.rb +89 -0
- data/spec/support/shared_contexts/model_with_class_methods.rb +29 -0
- data/spec/support/shared_contexts/persistable_model.rb +24 -0
- metadata +29 -54
- data/spec/omniauth/identity/models/couch_potato_spec.rb +0 -21
- data/spec/omniauth/identity/models/mongoid_spec.rb +0 -28
- data/spec/omniauth/identity/models/no_brainer_spec.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26637a55190cccdef70e9a1fc568005e23b7ebff9ba3ec6d2f5ea4398117f04d
|
4
|
+
data.tar.gz: d31d884aae50bd00c0d3820030c107def5bbcaf6507eb5628e068ac090ccc8c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86f91851a1e9884d95e3b3d765176f8faed5c7acbf7d79e168d803a09275c228a5cfe1221ee5fedd69689fccbc2af04d4857342bf5ae273f7a4d873a5e7e36c7
|
7
|
+
data.tar.gz: 81462770cbbd476db63d133831a36710178fef1702f5277a8a13248c17bf3fd91bba74f81337239b43202b10c079a3196f2ce912452c803e387c13b0c7361214
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,75 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
8
8
|
|
9
9
|
## [Unreleased]
|
10
10
|
|
11
|
+
## [3.0.8] - 2021-03-24
|
12
|
+
|
13
|
+
### Fixed
|
14
|
+
|
15
|
+
- \[Model\] Fixes 2 issues raised in a comment on PR [#108](https://github.com/omniauth/omniauth-identity/pull/108#issuecomment-804456604)
|
16
|
+
- When `options[:on_validation]` is set `new`/`save`/`persisted?` logic is used.
|
17
|
+
- When `options[:on_validation]` is not set `create`/`persisted?` logic is used.
|
18
|
+
|
19
|
+
## [3.0.7] - 2021-03-23
|
20
|
+
|
21
|
+
### Fixed
|
22
|
+
|
23
|
+
- \[ActiveRecord\] Fixed [#110](https://github.com/omniauth/omniauth-identity/issues/110) which prevented `OmniAuth::Identity::Models::ActiveRecord`-based records from saving.
|
24
|
+
- \[CouchPotato\] Fixed `OmniAuth::Identity::Models::CouchPotato`'s `#save`.
|
25
|
+
- \[Sequel\] Fixed `OmniAuth::Identity::Models::Sequel`'s `#save`.
|
26
|
+
- \[Model\] Only define `::create`, `#save`, and `#persisted?` when not already defined.
|
27
|
+
- \[Model\] Restore original `info` functionality which set `name` based on `first_name`, `last_name`, or `nickname`
|
28
|
+
|
29
|
+
### Changed
|
30
|
+
|
31
|
+
- Upgraded to a newer `OmniAuth::Identity::SecurePassword` ripped from [Rails 6-1-stable](https://github.com/rails/rails/blob/6-1-stable/activemodel/lib/active_model/secure_password.rb)
|
32
|
+
- Aeons ago the original was ripped from Rails 3.1, and frozen in time.
|
33
|
+
While writing specs, it was discovered to be incompatible with this gem's Sequel adapter.
|
34
|
+
- Specs validate that the new version does work.
|
35
|
+
In any case, the ripped version is only used when the `has_secure_password` macro is not yet defined in the class.
|
36
|
+
|
37
|
+
### Added
|
38
|
+
|
39
|
+
- New specs to cover real use cases and implementations of each ORM model adapter that ships with the gem:
|
40
|
+
- ActiveRecord (Polyglot - Many Relational Databases)
|
41
|
+
- Sequel (Polyglot - Many Relational Databases)
|
42
|
+
- CouchPotato (CouchDB)
|
43
|
+
- Mongoid (MongoDB)
|
44
|
+
- NoBrainer (RethinkDB)
|
45
|
+
|
46
|
+
## [3.0.6] - 2021-03-20
|
47
|
+
|
48
|
+
### Fixed
|
49
|
+
|
50
|
+
- Fix breaking changes introduced by [#108](https://github.com/omniauth/omniauth-identity/pull/108) which prevented `:on_validation` from firing
|
51
|
+
|
52
|
+
### Added
|
53
|
+
|
54
|
+
- New (or finally documented) options:
|
55
|
+
- `:create_identity_link_text` defaults to `'Create an Identity'`
|
56
|
+
- `:registration_failure_message` defaults to `'One or more fields were invalid'`
|
57
|
+
- `:validation_failure_message` defaults to `'Validation failed'`
|
58
|
+
- `:title` defaults to `'Identity Verification'`
|
59
|
+
- `:registration_form_title` defaults to `'Register Identity'`
|
60
|
+
|
61
|
+
## [3.0.5] - 2021-03-19
|
62
|
+
|
63
|
+
### Fixed
|
64
|
+
|
65
|
+
- Fix breaking changes introduced by [#86's](https://github.com/omniauth/omniauth-identity/pull/86) introduction of `:on_validation`
|
66
|
+
|
67
|
+
### Added
|
68
|
+
|
69
|
+
- Define `#save`, `#persisted?` and `::create` on `Omniauth::Identity::Model`
|
70
|
+
- Add `@since` YARD tags to interface methods
|
71
|
+
- Refactor `Omniauth::Strategies::Identity.registration_phase` to support `Omniauth::Identity::Model`-inheriting classes that do not define `#save`.
|
72
|
+
- This support will be dropped in v4.0.
|
73
|
+
|
74
|
+
## [3.0.4] - 2021-02-14
|
75
|
+
|
76
|
+
### Added
|
77
|
+
|
78
|
+
- Add support for [sequel ORM](http://sequel.jeremyevans.net/)
|
79
|
+
|
11
80
|
## [3.0.3] - 2021-02-14
|
12
81
|
|
13
82
|
### Added
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
[](https://rubygems.org/gems/omniauth-identity)
|
11
11
|
|
12
12
|
The OmniAuth Identity gem provides a way for applications to utilize a
|
13
|
-
traditional
|
13
|
+
traditional username/password based authentication system without the need
|
14
14
|
to give up the simple authentication flow provided by OmniAuth. Identity
|
15
15
|
is designed on purpose to be as featureless as possible: it provides the
|
16
16
|
basic construct for user management and then gets out of the way.
|
@@ -85,6 +85,22 @@ class Identity < OmniAuth::Identity::Models::ActiveRecord
|
|
85
85
|
end
|
86
86
|
```
|
87
87
|
|
88
|
+
### Sequel
|
89
|
+
|
90
|
+
[Sequel](http://sequel.jeremyevans.net/) is an alternative to ActiveRecord.
|
91
|
+
|
92
|
+
Just include `OmniAuth::Identity::Models::Sequel` mixin, and specify
|
93
|
+
whatever else you will need.
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
class SequelTestIdentity < Sequel::Model(:identities)
|
97
|
+
include ::OmniAuth::Identity::Models::Sequel
|
98
|
+
auth_key :email
|
99
|
+
# whatever else you want!
|
100
|
+
end
|
101
|
+
```
|
102
|
+
|
103
|
+
|
88
104
|
### Mongoid
|
89
105
|
|
90
106
|
Include the `OmniAuth::Identity::Models::Mongoid` mixin and specify
|
@@ -92,8 +108,8 @@ fields that you will need.
|
|
92
108
|
|
93
109
|
```ruby
|
94
110
|
class Identity
|
95
|
-
include Mongoid::Document
|
96
|
-
include OmniAuth::Identity::Models::Mongoid
|
111
|
+
include ::Mongoid::Document
|
112
|
+
include ::OmniAuth::Identity::Models::Mongoid
|
97
113
|
|
98
114
|
field :email, type: String
|
99
115
|
field :name, type: String
|
@@ -103,12 +119,14 @@ end
|
|
103
119
|
|
104
120
|
### CouchPotato
|
105
121
|
|
106
|
-
Include the `OmniAuth::Identity::Models::CouchPotatoModule` mixin and specify
|
122
|
+
Include the `OmniAuth::Identity::Models::CouchPotatoModule` mixin and specify
|
123
|
+
fields that you will need.
|
107
124
|
|
108
125
|
```ruby
|
109
126
|
class Identity
|
110
|
-
|
111
|
-
include
|
127
|
+
# NOTE: CouchPotato::Persistence must be included before OmniAuth::Identity::Models::CouchPotatoModule
|
128
|
+
include ::CouchPotato::Persistence
|
129
|
+
include ::OmniAuth::Identity::Models::CouchPotatoModule
|
112
130
|
|
113
131
|
property :email
|
114
132
|
property :password_digest
|
@@ -125,12 +143,13 @@ end
|
|
125
143
|
|
126
144
|
[NoBrainer](http://nobrainer.io/) is an ORM for [RethinkDB](https://rethinkdb.com/).
|
127
145
|
|
128
|
-
Include the `OmniAuth::Identity::Models::NoBrainer` mixin and specify
|
146
|
+
Include the `OmniAuth::Identity::Models::NoBrainer` mixin and specify
|
147
|
+
fields that you will need.
|
129
148
|
|
130
149
|
```ruby
|
131
150
|
class Identity
|
132
|
-
include NoBrainer::Document
|
133
|
-
include OmniAuth::Identity::Models::NoBrainer
|
151
|
+
include ::NoBrainer::Document
|
152
|
+
include ::OmniAuth::Identity::Models::NoBrainer
|
134
153
|
|
135
154
|
auth_key :email
|
136
155
|
end
|
@@ -227,12 +246,75 @@ Note: Be careful when customizing `locate_conditions`. The best way to modify t
|
|
227
246
|
to copy the default value, and then add to the hash. Removing the default condition will almost
|
228
247
|
always break things!
|
229
248
|
|
249
|
+
## Customizing Other Things
|
250
|
+
|
251
|
+
From the code - here are the options we have for you, a couple of which are documented above, and the rest are documented... in the specs we hope!?
|
252
|
+
```
|
253
|
+
option :fields, %i[name email]
|
254
|
+
|
255
|
+
# Primary Feature Switches:
|
256
|
+
option :enable_registration, true # See #other_phase and #request_phase
|
257
|
+
option :enable_login, true # See #other_phase
|
258
|
+
|
259
|
+
# Customization Options:
|
260
|
+
option :on_login, nil # See #request_phase
|
261
|
+
option :on_validation, nil # See #registration_phase
|
262
|
+
option :on_registration, nil # See #registration_phase
|
263
|
+
option :on_failed_registration, nil # See #registration_phase
|
264
|
+
option :locate_conditions, ->(req) { { model.auth_key => req['auth_key'] } }
|
265
|
+
```
|
266
|
+
|
267
|
+
Please contribute some documentation if you have the gumption! The maintainer's time is limited, and sometimes the authors of PRs with new options don't update the _this_ readme. 😭
|
268
|
+
|
269
|
+
## Contributing
|
270
|
+
|
271
|
+
1. Fork it
|
272
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
273
|
+
3. Commit your changes (`git commit -am ‘Added some feature’`)
|
274
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
275
|
+
5. Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
|
276
|
+
- NOTE: In order to run *all* the tests you will need to have the following databases installed, configured, and running.
|
277
|
+
1. [RethinkDB](https://rethinkdb.com), an open source, real-time, web database, [installed](https://rethinkdb.com/docs/install/) and [running](https://rethinkdb.com/docs/start-a-server/), e.g.
|
278
|
+
```bash
|
279
|
+
brew install rethinkdb
|
280
|
+
rethinkdb
|
281
|
+
```
|
282
|
+
2. [MongoDB](https://docs.mongodb.com/manual/administration/install-community/)
|
283
|
+
```bash
|
284
|
+
brew tap mongodb/brew
|
285
|
+
brew install mongodb-community@4.4
|
286
|
+
mongod --config /usr/local/etc/mongod.conf
|
287
|
+
```
|
288
|
+
3. [CouchDB](https://couchdb.apache.org) (download the .app)
|
289
|
+
To run all tests on all databases:
|
290
|
+
```bash
|
291
|
+
bundle exec rake
|
292
|
+
```
|
293
|
+
To run a specific DB:
|
294
|
+
```bash
|
295
|
+
# CouchDB / CouchPotato
|
296
|
+
bundle exec rspec spec spec_orms --tag 'couchdb'
|
297
|
+
|
298
|
+
# ActiveRecord and Sequel, as they both use the in-memory SQLite driver.
|
299
|
+
bundle exec rspec spec spec_orms --tag 'sqlite3'
|
300
|
+
|
301
|
+
# NOTE - mongoid and nobrainer specs can't be isolated with "tag" because it still loads everything,
|
302
|
+
# and the two libraries are fundamentally incompatible.
|
303
|
+
|
304
|
+
# MongoDB / Mongoid
|
305
|
+
bundle exec rspec spec_orms/mongoid_spec.rb
|
306
|
+
|
307
|
+
# RethinkDB / NoBrainer
|
308
|
+
bundle exec rspec spec_orms/nobrainer_spec.rb
|
309
|
+
```
|
310
|
+
6. Create new Pull Request
|
311
|
+
|
230
312
|
## License
|
231
313
|
|
232
314
|
MIT License. See LICENSE for details.
|
233
315
|
|
234
316
|
## Copyright
|
235
317
|
|
236
|
-
Copyright (c) 2021 OmniAuth-Identity Maintainers
|
237
|
-
Copyright (c) 2020 Peter Boling, Andrew Roberts, and Jellybooks Ltd.
|
238
|
-
Copyright (c) 2010-2015 Michael Bleigh, and Intridea, Inc.
|
318
|
+
* Copyright (c) 2021 OmniAuth-Identity Maintainers
|
319
|
+
* Copyright (c) 2020 Peter Boling, Andrew Roberts, and Jellybooks Ltd.
|
320
|
+
* Copyright (c) 2010-2015 Michael Bleigh, and Intridea, Inc.
|
data/lib/omniauth/identity.rb
CHANGED
@@ -14,7 +14,8 @@ module OmniAuth
|
|
14
14
|
autoload :ActiveRecord, 'omniauth/identity/models/active_record'
|
15
15
|
autoload :Mongoid, 'omniauth/identity/models/mongoid'
|
16
16
|
autoload :CouchPotatoModule, 'omniauth/identity/models/couch_potato'
|
17
|
-
autoload :NoBrainer, 'omniauth/identity/models/
|
17
|
+
autoload :NoBrainer, 'omniauth/identity/models/nobrainer'
|
18
|
+
autoload :Sequel, 'omniauth/identity/models/sequel'
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
@@ -4,24 +4,34 @@ module OmniAuth
|
|
4
4
|
module Identity
|
5
5
|
# This module provides an includable interface for implementing the
|
6
6
|
# necessary API for OmniAuth Identity to properly locate identities
|
7
|
-
# and provide all necessary information.
|
8
|
-
#
|
9
|
-
#
|
7
|
+
# and provide all necessary information.
|
8
|
+
#
|
9
|
+
# All methods marked as abstract must be implemented in the
|
10
|
+
# including class for things to work properly.
|
11
|
+
#
|
12
|
+
### Singleton API
|
13
|
+
#
|
14
|
+
# * locate(key)
|
15
|
+
# * create(*args) - Deprecated in v3.0.5; Will be removed in v4.0
|
16
|
+
#
|
17
|
+
### Instance API
|
18
|
+
#
|
19
|
+
# * save
|
20
|
+
# * persisted?
|
21
|
+
# * authenticate(password)
|
22
|
+
#
|
10
23
|
module Model
|
24
|
+
SCHEMA_ATTRIBUTES = %w[name email nickname first_name last_name location description image phone].freeze
|
25
|
+
|
11
26
|
def self.included(base)
|
12
27
|
base.extend ClassMethods
|
28
|
+
base.extend ClassCreateApi unless base.respond_to?(:create)
|
29
|
+
im = base.instance_methods
|
30
|
+
base.include InstanceSaveApi unless im.include?(:save)
|
31
|
+
base.include InstancePersistedApi unless im.include?(:persisted?)
|
13
32
|
end
|
14
33
|
|
15
34
|
module ClassMethods
|
16
|
-
# Locate an identity given its unique login key.
|
17
|
-
#
|
18
|
-
# @abstract
|
19
|
-
# @param [String] key The unique login key.
|
20
|
-
# @return [Model] An instance of the identity model class.
|
21
|
-
def locate(key)
|
22
|
-
raise NotImplementedError
|
23
|
-
end
|
24
|
-
|
25
35
|
# Authenticate a user with the given key and password.
|
26
36
|
#
|
27
37
|
# @param [String] key The unique login key provided for a given identity.
|
@@ -43,6 +53,56 @@ module OmniAuth
|
|
43
53
|
|
44
54
|
@auth_key || 'email'
|
45
55
|
end
|
56
|
+
|
57
|
+
# Locate an identity given its unique login key.
|
58
|
+
#
|
59
|
+
# @abstract
|
60
|
+
# @param [String] key The unique login key.
|
61
|
+
# @return [Model] An instance of the identity model class.
|
62
|
+
def locate(_key)
|
63
|
+
raise NotImplementedError
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
module ClassCreateApi
|
68
|
+
# Persists a new Identity object to the ORM.
|
69
|
+
# Only included if the class doesn't define create, as a reminder to define create.
|
70
|
+
# Override as needed per ORM.
|
71
|
+
#
|
72
|
+
# @deprecated v4.0 will begin using {#new} with {#save} instead.
|
73
|
+
# @abstract
|
74
|
+
# @param [Hash] args Attributes of the new instance.
|
75
|
+
# @return [Model] An instance of the identity model class.
|
76
|
+
# @since 3.0.5
|
77
|
+
def create(*_args)
|
78
|
+
raise NotImplementedError
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
module InstanceSaveApi
|
83
|
+
# Persists a new Identity object to the ORM.
|
84
|
+
# Default raises an error. Override as needed per ORM.
|
85
|
+
# This base version's arguments are modeled after ActiveModel
|
86
|
+
# since it is a pattern many ORMs follow
|
87
|
+
#
|
88
|
+
# @abstract
|
89
|
+
# @return [Model] An instance of the identity model class.
|
90
|
+
# @since 3.0.5
|
91
|
+
def save(**_options, &_block)
|
92
|
+
raise NotImplementedError
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
module InstancePersistedApi
|
97
|
+
# Checks if the Identity object is persisted in the ORM.
|
98
|
+
# Default raises an error. Override as needed per ORM.
|
99
|
+
#
|
100
|
+
# @abstract
|
101
|
+
# @return [true or false] true if object exists, false if not.
|
102
|
+
# @since 3.0.5
|
103
|
+
def persisted?
|
104
|
+
raise NotImplementedError
|
105
|
+
end
|
46
106
|
end
|
47
107
|
|
48
108
|
# Returns self if the provided password is correct, false
|
@@ -51,26 +111,10 @@ module OmniAuth
|
|
51
111
|
# @abstract
|
52
112
|
# @param [String] password The password to check.
|
53
113
|
# @return [self or false] Self if authenticated, false if not.
|
54
|
-
def authenticate(
|
114
|
+
def authenticate(_password)
|
55
115
|
raise NotImplementedError
|
56
116
|
end
|
57
117
|
|
58
|
-
SCHEMA_ATTRIBUTES = %w[name email nickname first_name last_name location description image phone].freeze
|
59
|
-
# A hash of as much of the standard OmniAuth schema as is stored
|
60
|
-
# in this particular model. By default, this will call instance
|
61
|
-
# methods for each of the attributes it needs in turn, ignoring
|
62
|
-
# any for which `#respond_to?` is `false`.
|
63
|
-
#
|
64
|
-
# If `first_name`, `nickname`, and/or `last_name` is provided but
|
65
|
-
# `name` is not, it will be automatically calculated.
|
66
|
-
#
|
67
|
-
# @return [Hash] A string-keyed hash of user information.
|
68
|
-
def info
|
69
|
-
SCHEMA_ATTRIBUTES.each_with_object({}) do |attribute, hash|
|
70
|
-
hash[attribute] = send(attribute) if respond_to?(attribute)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
118
|
# An identifying string that must be globally unique to the
|
75
119
|
# application. Defaults to stringifying the `id` method.
|
76
120
|
#
|
@@ -113,6 +157,25 @@ module OmniAuth
|
|
113
157
|
raise NotImplementedError
|
114
158
|
end
|
115
159
|
end
|
160
|
+
|
161
|
+
# A hash of as much of the standard OmniAuth schema as is stored
|
162
|
+
# in this particular model. By default, this will call instance
|
163
|
+
# methods for each of the attributes it needs in turn, ignoring
|
164
|
+
# any for which `#respond_to?` is `false`.
|
165
|
+
#
|
166
|
+
# If `first_name`, `nickname`, and/or `last_name` is provided but
|
167
|
+
# `name` is not, it will be automatically calculated.
|
168
|
+
#
|
169
|
+
# @return [Hash] A string-keyed hash of user information.
|
170
|
+
def info
|
171
|
+
info = {}
|
172
|
+
SCHEMA_ATTRIBUTES.each_with_object(info) do |attribute, hash|
|
173
|
+
hash[attribute] = send(attribute) if respond_to?(attribute)
|
174
|
+
end
|
175
|
+
info['name'] ||= [info['first_name'], info['last_name']].join(' ').strip if info['first_name'] || info['last_name']
|
176
|
+
info['name'] ||= info['nickname']
|
177
|
+
info
|
178
|
+
end
|
116
179
|
end
|
117
180
|
end
|
118
181
|
end
|
@@ -6,8 +6,8 @@ module OmniAuth
|
|
6
6
|
module Identity
|
7
7
|
module Models
|
8
8
|
class ActiveRecord < ::ActiveRecord::Base
|
9
|
-
include OmniAuth::Identity::Model
|
10
|
-
include OmniAuth::Identity::SecurePassword
|
9
|
+
include ::OmniAuth::Identity::Model
|
10
|
+
include ::OmniAuth::Identity::SecurePassword
|
11
11
|
|
12
12
|
self.abstract_class = true
|
13
13
|
has_secure_password
|
@@ -6,6 +6,8 @@ module OmniAuth
|
|
6
6
|
module Identity
|
7
7
|
module Models
|
8
8
|
# can not be named CouchPotato since there is a class with that name
|
9
|
+
# NOTE: CouchPotato is based on ActiveModel.
|
10
|
+
# NOTE: CouchPotato::Persistence must be included before OmniAuth::Identity::Models::CouchPotatoModule
|
9
11
|
module CouchPotatoModule
|
10
12
|
def self.included(base)
|
11
13
|
base.class_eval do
|
@@ -22,6 +24,10 @@ module OmniAuth
|
|
22
24
|
def self.locate(search_hash)
|
23
25
|
where(search_hash).first
|
24
26
|
end
|
27
|
+
|
28
|
+
def save
|
29
|
+
CouchPotato.database.save(self)
|
30
|
+
end
|
25
31
|
end
|
26
32
|
end
|
27
33
|
end
|