devise-async 0.3.1 → 0.4.0
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.
- data/CHANGELOG.md +7 -0
- data/README.md +13 -15
- data/lib/devise/async.rb +2 -0
- data/lib/devise/async/backend/delayed_job.rb +1 -1
- data/lib/devise/async/model.rb +11 -0
- data/lib/devise/async/version.rb +1 -1
- data/test/support/rails_app/app/models/admin.rb +1 -3
- data/test/test_helper.rb +1 -1
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -26,18 +26,23 @@ Or install it yourself as:
|
|
26
26
|
|
27
27
|
## Usage
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
Include `Devise::Async::Model` to your Devise model
|
29
|
+
Add `:async` to the `devise` call in your model:
|
32
30
|
|
33
31
|
```ruby
|
34
32
|
class User < ActiveRecord::Base
|
35
|
-
devise :database_authenticatable, :confirmable # etc ...
|
36
|
-
|
37
|
-
include Devise::Async::Model # should be below call to `devise`
|
33
|
+
devise :database_authenticatable, :async, :confirmable # etc ...
|
38
34
|
end
|
39
35
|
```
|
40
36
|
|
37
|
+
Set your queuing backend by creating `config/initializers/devise_async.rb`:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
# Supported options: :resque, :sidekiq, :delayed_job
|
41
|
+
Devise::Async.backend = :resque
|
42
|
+
```
|
43
|
+
|
44
|
+
Tip: it defaults to Resque. You don't need to create the initializer if using it.
|
45
|
+
|
41
46
|
### Devise < 2.1.1
|
42
47
|
|
43
48
|
Set `Devise::Async::Proxy` as Devise's mailer in `config/initializers/devise.rb`:
|
@@ -46,16 +51,9 @@ Set `Devise::Async::Proxy` as Devise's mailer in `config/initializers/devise.rb`
|
|
46
51
|
# Configure the class responsible to send e-mails.
|
47
52
|
config.mailer = "Devise::Async::Proxy"
|
48
53
|
```
|
49
|
-
### All
|
50
|
-
|
51
|
-
Set your queuing backend by creating `config/initializers/devise_async.rb`:
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
-
Devise::Async.backend = :resque
|
56
|
-
```
|
57
|
-
|
58
|
-
Tip: it defaults to Resque. You don't need to create the initializer if using it.
|
55
|
+
Note: before devise 2.1.1 devise-async had issues with background jobs trying to run
|
56
|
+
before the record was committed to the DB if the creation was transactioned.
|
59
57
|
|
60
58
|
## Advanced Options
|
61
59
|
|
data/lib/devise/async.rb
CHANGED
data/lib/devise/async/model.rb
CHANGED
@@ -1,8 +1,19 @@
|
|
1
1
|
module Devise
|
2
|
+
# TODO remove when appropriate
|
2
3
|
module Async
|
3
4
|
module Model
|
4
5
|
extend ActiveSupport::Concern
|
5
6
|
|
7
|
+
included do
|
8
|
+
warn "Including Devise::Async::Model directly in your models is no longer supported and won't work. Please add `:async` to your `devise` call."
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
module Models
|
14
|
+
module Async
|
15
|
+
extend ActiveSupport::Concern
|
16
|
+
|
6
17
|
included do
|
7
18
|
if respond_to?(:after_commit) # AR only
|
8
19
|
after_commit :send_devise_pending_notifications
|
data/lib/devise/async/version.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
class Admin < ActiveRecord::Base
|
2
2
|
devise :database_authenticatable, :confirmable, :lockable, :recoverable,
|
3
3
|
:registerable, :rememberable, :timeoutable, :token_authenticatable,
|
4
|
-
:trackable, :validatable
|
5
|
-
|
6
|
-
include Devise::Async::Model
|
4
|
+
:trackable, :validatable, :async
|
7
5
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise-async
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: devise
|
@@ -232,7 +232,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
232
232
|
version: '0'
|
233
233
|
segments:
|
234
234
|
- 0
|
235
|
-
hash: -
|
235
|
+
hash: -1947628383257764484
|
236
236
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
237
237
|
none: false
|
238
238
|
requirements:
|
@@ -241,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
241
|
version: '0'
|
242
242
|
segments:
|
243
243
|
- 0
|
244
|
-
hash: -
|
244
|
+
hash: -1947628383257764484
|
245
245
|
requirements: []
|
246
246
|
rubyforge_project:
|
247
247
|
rubygems_version: 1.8.23
|