activity_notification 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +15 -5
- data/CHANGELOG.md +13 -2
- data/Gemfile +1 -1
- data/Gemfile.lock +78 -71
- data/README.md +64 -43
- data/activity_notification.gemspec +5 -4
- data/app/controllers/activity_notification/notifications_controller.rb +1 -1
- data/app/controllers/activity_notification/subscriptions_controller.rb +1 -1
- data/gemfiles/Gemfile.rails-4.2 +1 -1
- data/gemfiles/Gemfile.rails-4.2.lock +71 -62
- data/gemfiles/Gemfile.rails-5.0 +1 -1
- data/gemfiles/Gemfile.rails-5.0.lock +74 -67
- data/lib/activity_notification.rb +9 -2
- data/lib/activity_notification/apis/notification_api.rb +142 -76
- data/lib/activity_notification/apis/subscription_api.rb +72 -0
- data/lib/activity_notification/config.rb +12 -0
- data/lib/activity_notification/models/concerns/notifiable.rb +56 -6
- data/lib/activity_notification/models/concerns/notifier.rb +8 -1
- data/lib/activity_notification/models/concerns/subscriber.rb +13 -10
- data/lib/activity_notification/models/concerns/target.rb +7 -5
- data/lib/activity_notification/models/notification.rb +2 -270
- data/lib/activity_notification/models/subscription.rb +3 -101
- data/lib/activity_notification/optional_targets/base.rb +5 -1
- data/lib/activity_notification/orm/active_record.rb +16 -0
- data/lib/activity_notification/orm/active_record/notification.rb +252 -0
- data/lib/activity_notification/orm/active_record/subscription.rb +52 -0
- data/lib/activity_notification/orm/mongoid.rb +63 -0
- data/lib/activity_notification/orm/mongoid/notification.rb +255 -0
- data/lib/activity_notification/orm/mongoid/subscription.rb +73 -0
- data/lib/activity_notification/rails/routes.rb +7 -3
- data/lib/activity_notification/renderable.rb +5 -1
- data/lib/activity_notification/roles/acts_as_notifiable.rb +4 -18
- data/lib/activity_notification/version.rb +1 -1
- data/lib/generators/activity_notification/install_generator.rb +3 -5
- data/lib/generators/templates/activity_notification.rb +9 -4
- data/spec/concerns/apis/notification_api_spec.rb +27 -14
- data/spec/concerns/models/notifiable_spec.rb +10 -8
- data/spec/concerns/models/subscriber_spec.rb +12 -12
- data/spec/concerns/models/target_spec.rb +61 -51
- data/spec/controllers/subscriptions_controller_shared_examples.rb +0 -1
- data/spec/helpers/view_helpers_spec.rb +24 -7
- data/spec/models/notification_spec.rb +63 -52
- data/spec/models/subscription_spec.rb +6 -3
- data/spec/optional_targets/amazon_sns_spec.rb +8 -5
- data/spec/optional_targets/base_spec.rb +3 -1
- data/spec/optional_targets/slack_spec.rb +5 -5
- data/spec/rails_app/app/models/comment.rb +1 -1
- data/spec/rails_app/app/views/activity_notification/notifications/users/overriden/custom/_test.html.erb +1 -0
- data/spec/rails_app/config/application.rb +7 -0
- data/spec/rails_app/config/initializers/activity_notification.rb +5 -0
- data/spec/rails_app/config/mongoid.yml +13 -0
- data/spec/rails_app/db/seeds.rb +1 -1
- data/spec/rails_app/lib/custom_optional_targets/console_output.rb +7 -4
- data/spec/rails_app/lib/custom_optional_targets/wrong_target.rb +3 -0
- data/spec/roles/acts_as_notifiable_spec.rb +77 -16
- data/spec/spec_helper.rb +7 -0
- metadata +38 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e179e93cf2ac56df97de6634905fa1167b46ed6c
|
4
|
+
data.tar.gz: 1ee6aa961fcaf36d1b57d51b6eb984b4994c0b1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 013879fc731c40a053424a7a1910602f551baf17f200fbdd297458dbf45d3d8dd09c4eed978096ae9939da7b76bd8233ec860cd1a56d6d3f3f7cdbe1072ddb1a
|
7
|
+
data.tar.gz: 46afc218dd6ee8feded9f54acfc0819a9fb60ab956bd5e80f83aa9975f3b9b9d92bbaa221a3d427d023ebbae6401a9d0c622cf8838a97d279ee86cd881b77826
|
data/.travis.yml
CHANGED
@@ -5,9 +5,10 @@ branches:
|
|
5
5
|
- images
|
6
6
|
|
7
7
|
rvm:
|
8
|
-
- 2.1.
|
9
|
-
- 2.2.
|
10
|
-
- 2.3.
|
8
|
+
- 2.1.10
|
9
|
+
- 2.2.7
|
10
|
+
- 2.3.4
|
11
|
+
- 2.4.1
|
11
12
|
- ruby-head
|
12
13
|
|
13
14
|
gemfile:
|
@@ -15,16 +16,25 @@ gemfile:
|
|
15
16
|
- gemfiles/Gemfile.rails-5.0
|
16
17
|
- gemfiles/Gemfile.rails-4.2
|
17
18
|
|
19
|
+
env:
|
20
|
+
- AN_ORM=active_record
|
21
|
+
- AN_ORM=mongoid
|
22
|
+
|
18
23
|
matrix:
|
19
24
|
exclude:
|
20
|
-
- rvm: 2.1.
|
25
|
+
- rvm: 2.1.10
|
21
26
|
gemfile: gemfiles/Gemfile.rails-5.0
|
22
|
-
- rvm: 2.1.
|
27
|
+
- rvm: 2.1.10
|
28
|
+
gemfile: Gemfile
|
29
|
+
- env: AN_ORM=mongoid
|
23
30
|
gemfile: Gemfile
|
24
31
|
allow_failures:
|
25
32
|
- rvm: ruby-head
|
26
33
|
fast_finish: true
|
27
34
|
|
35
|
+
services:
|
36
|
+
- mongodb
|
37
|
+
|
28
38
|
sudo: false
|
29
39
|
|
30
40
|
cache: bundler
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,23 @@
|
|
1
|
+
## 1.3.0 / 2017-04-07
|
2
|
+
[Full Changelog](http://github.com/simukappu/activity_notification/compare/v1.2.1...v1.3.0)
|
3
|
+
|
4
|
+
Enhancements:
|
5
|
+
* Suport Mongoid ORM to store `Notification` and `Subscription` records
|
6
|
+
* Separate `Notification` and `Subscription` models into ORMs and make them load from ORM selector
|
7
|
+
* Update query logic in `Notification` and `Subscription` models for Mongoid
|
8
|
+
* Make `:dependent_notifications` option in `acts_as_notifiable` separate into each target configuration
|
9
|
+
* Add `overriding_notification_template_key` to `Notifiable` model for `Renderable`
|
10
|
+
* Enable Devise integration to use models with single table inheritance
|
11
|
+
|
1
12
|
## 1.2.1 / 2017-01-06
|
2
13
|
[Full Changelog](http://github.com/simukappu/activity_notification/compare/v1.2.0...v1.2.1)
|
3
14
|
|
4
15
|
Enhancements:
|
5
|
-
* Support default Slack optional target with slack-notifier 2.0.0
|
16
|
+
* Support default Slack optional target with `slack-notifier` 2.0.0
|
6
17
|
|
7
18
|
Breaking Changes:
|
8
19
|
|
9
|
-
* Rename
|
20
|
+
* Rename `:slack_name` initializing parameter and template parameter of default Slack optional target to `:target_username`
|
10
21
|
|
11
22
|
## 1.2.0 / 2017-01-06
|
12
23
|
[Full Changelog](http://github.com/simukappu/activity_notification/compare/v1.1.0...v1.2.0)
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activity_notification (1.
|
4
|
+
activity_notification (1.3.0)
|
5
5
|
activerecord (>= 4.2.0)
|
6
6
|
i18n (>= 0.5.0)
|
7
7
|
jquery-rails (>= 3.1.1)
|
@@ -10,39 +10,39 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
actioncable (5.0.
|
14
|
-
actionpack (= 5.0.
|
15
|
-
nio4r (
|
13
|
+
actioncable (5.0.2)
|
14
|
+
actionpack (= 5.0.2)
|
15
|
+
nio4r (>= 1.2, < 3.0)
|
16
16
|
websocket-driver (~> 0.6.1)
|
17
|
-
actionmailer (5.0.
|
18
|
-
actionpack (= 5.0.
|
19
|
-
actionview (= 5.0.
|
20
|
-
activejob (= 5.0.
|
17
|
+
actionmailer (5.0.2)
|
18
|
+
actionpack (= 5.0.2)
|
19
|
+
actionview (= 5.0.2)
|
20
|
+
activejob (= 5.0.2)
|
21
21
|
mail (~> 2.5, >= 2.5.4)
|
22
22
|
rails-dom-testing (~> 2.0)
|
23
|
-
actionpack (5.0.
|
24
|
-
actionview (= 5.0.
|
25
|
-
activesupport (= 5.0.
|
23
|
+
actionpack (5.0.2)
|
24
|
+
actionview (= 5.0.2)
|
25
|
+
activesupport (= 5.0.2)
|
26
26
|
rack (~> 2.0)
|
27
27
|
rack-test (~> 0.6.3)
|
28
28
|
rails-dom-testing (~> 2.0)
|
29
29
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
30
|
-
actionview (5.0.
|
31
|
-
activesupport (= 5.0.
|
30
|
+
actionview (5.0.2)
|
31
|
+
activesupport (= 5.0.2)
|
32
32
|
builder (~> 3.1)
|
33
33
|
erubis (~> 2.7.0)
|
34
34
|
rails-dom-testing (~> 2.0)
|
35
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
36
|
-
activejob (5.0.
|
37
|
-
activesupport (= 5.0.
|
35
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
36
|
+
activejob (5.0.2)
|
37
|
+
activesupport (= 5.0.2)
|
38
38
|
globalid (>= 0.3.6)
|
39
|
-
activemodel (5.0.
|
40
|
-
activesupport (= 5.0.
|
41
|
-
activerecord (5.0.
|
42
|
-
activemodel (= 5.0.
|
43
|
-
activesupport (= 5.0.
|
39
|
+
activemodel (5.0.2)
|
40
|
+
activesupport (= 5.0.2)
|
41
|
+
activerecord (5.0.2)
|
42
|
+
activemodel (= 5.0.2)
|
43
|
+
activesupport (= 5.0.2)
|
44
44
|
arel (~> 7.0)
|
45
|
-
activesupport (5.0.
|
45
|
+
activesupport (5.0.2)
|
46
46
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
47
47
|
i18n (~> 0.7)
|
48
48
|
minitest (~> 5.1)
|
@@ -52,38 +52,39 @@ GEM
|
|
52
52
|
railties (>= 3.0)
|
53
53
|
rspec-rails (>= 2.2)
|
54
54
|
arel (7.1.4)
|
55
|
-
aws-sdk (2.
|
56
|
-
aws-sdk-resources (= 2.
|
57
|
-
aws-sdk-core (2.
|
55
|
+
aws-sdk (2.9.1)
|
56
|
+
aws-sdk-resources (= 2.9.1)
|
57
|
+
aws-sdk-core (2.9.1)
|
58
58
|
aws-sigv4 (~> 1.0)
|
59
59
|
jmespath (~> 1.0)
|
60
|
-
aws-sdk-resources (2.
|
61
|
-
aws-sdk-core (= 2.
|
60
|
+
aws-sdk-resources (2.9.1)
|
61
|
+
aws-sdk-core (= 2.9.1)
|
62
62
|
aws-sigv4 (1.0.0)
|
63
63
|
bcrypt (3.1.11)
|
64
|
-
|
65
|
-
|
64
|
+
bson (4.2.1)
|
65
|
+
builder (3.2.3)
|
66
|
+
bullet (5.5.1)
|
66
67
|
activesupport (>= 3.0.0)
|
67
68
|
uniform_notifier (~> 1.10.0)
|
68
|
-
concurrent-ruby (1.0.
|
69
|
-
coveralls (0.8.
|
69
|
+
concurrent-ruby (1.0.5)
|
70
|
+
coveralls (0.8.20)
|
70
71
|
json (>= 1.8, < 3)
|
71
|
-
simplecov (~> 0.
|
72
|
+
simplecov (~> 0.14.1)
|
72
73
|
term-ansicolor (~> 1.3)
|
73
|
-
thor (~> 0.19.
|
74
|
+
thor (~> 0.19.4)
|
74
75
|
tins (~> 1.6)
|
75
|
-
devise (4.2.
|
76
|
+
devise (4.2.1)
|
76
77
|
bcrypt (~> 3.0)
|
77
78
|
orm_adapter (~> 0.1)
|
78
79
|
railties (>= 4.1.0, < 5.1)
|
79
80
|
responders
|
80
81
|
warden (~> 1.2.3)
|
81
|
-
diff-lcs (1.
|
82
|
+
diff-lcs (1.3)
|
82
83
|
docile (1.1.5)
|
83
|
-
dotenv (2.
|
84
|
-
dotenv-rails (2.
|
85
|
-
dotenv (= 2.
|
86
|
-
railties (>=
|
84
|
+
dotenv (2.2.0)
|
85
|
+
dotenv-rails (2.2.0)
|
86
|
+
dotenv (= 2.2.0)
|
87
|
+
railties (>= 3.2, < 5.1)
|
87
88
|
erubis (2.7.0)
|
88
89
|
factory_girl (4.8.0)
|
89
90
|
activesupport (>= 3.0.0)
|
@@ -92,13 +93,13 @@ GEM
|
|
92
93
|
railties (>= 3.0.0)
|
93
94
|
globalid (0.3.7)
|
94
95
|
activesupport (>= 4.1.0)
|
95
|
-
i18n (0.
|
96
|
+
i18n (0.8.1)
|
96
97
|
jmespath (1.3.1)
|
97
|
-
jquery-rails (4.
|
98
|
+
jquery-rails (4.3.1)
|
98
99
|
rails-dom-testing (>= 1, < 3)
|
99
100
|
railties (>= 4.2.0)
|
100
101
|
thor (>= 0.14, < 2.0)
|
101
|
-
json (2.0.
|
102
|
+
json (2.0.3)
|
102
103
|
loofah (2.0.3)
|
103
104
|
nokogiri (>= 1.5.9)
|
104
105
|
mail (2.6.4)
|
@@ -109,24 +110,29 @@ GEM
|
|
109
110
|
mime-types-data (3.2016.0521)
|
110
111
|
mini_portile2 (2.1.0)
|
111
112
|
minitest (5.10.1)
|
112
|
-
|
113
|
-
|
113
|
+
mongo (2.4.1)
|
114
|
+
bson (>= 4.2.1, < 5.0.0)
|
115
|
+
mongoid (6.1.0)
|
116
|
+
activemodel (~> 5.0)
|
117
|
+
mongo (>= 2.4.1, < 3.0.0)
|
118
|
+
nio4r (2.0.0)
|
119
|
+
nokogiri (1.7.1)
|
114
120
|
mini_portile2 (~> 2.1.0)
|
115
121
|
orm_adapter (0.5.0)
|
116
122
|
rack (2.0.1)
|
117
123
|
rack-test (0.6.3)
|
118
124
|
rack (>= 1.0)
|
119
|
-
rails (5.0.
|
120
|
-
actioncable (= 5.0.
|
121
|
-
actionmailer (= 5.0.
|
122
|
-
actionpack (= 5.0.
|
123
|
-
actionview (= 5.0.
|
124
|
-
activejob (= 5.0.
|
125
|
-
activemodel (= 5.0.
|
126
|
-
activerecord (= 5.0.
|
127
|
-
activesupport (= 5.0.
|
125
|
+
rails (5.0.2)
|
126
|
+
actioncable (= 5.0.2)
|
127
|
+
actionmailer (= 5.0.2)
|
128
|
+
actionpack (= 5.0.2)
|
129
|
+
actionview (= 5.0.2)
|
130
|
+
activejob (= 5.0.2)
|
131
|
+
activemodel (= 5.0.2)
|
132
|
+
activerecord (= 5.0.2)
|
133
|
+
activesupport (= 5.0.2)
|
128
134
|
bundler (>= 1.3.0, < 2.0)
|
129
|
-
railties (= 5.0.
|
135
|
+
railties (= 5.0.2)
|
130
136
|
sprockets-rails (>= 2.0.0)
|
131
137
|
rails-controller-testing (1.0.1)
|
132
138
|
actionpack (~> 5.x)
|
@@ -137,9 +143,9 @@ GEM
|
|
137
143
|
nokogiri (~> 1.6)
|
138
144
|
rails-html-sanitizer (1.0.3)
|
139
145
|
loofah (~> 2.0)
|
140
|
-
railties (5.0.
|
141
|
-
actionpack (= 5.0.
|
142
|
-
activesupport (= 5.0.
|
146
|
+
railties (5.0.2)
|
147
|
+
actionpack (= 5.0.2)
|
148
|
+
activesupport (= 5.0.2)
|
143
149
|
method_source
|
144
150
|
rake (>= 0.8.7)
|
145
151
|
thor (>= 0.18.1, < 2.0)
|
@@ -163,12 +169,12 @@ GEM
|
|
163
169
|
rspec-mocks (~> 3.5.0)
|
164
170
|
rspec-support (~> 3.5.0)
|
165
171
|
rspec-support (3.5.0)
|
166
|
-
simplecov (0.
|
172
|
+
simplecov (0.14.1)
|
167
173
|
docile (~> 1.1.0)
|
168
174
|
json (>= 1.8, < 3)
|
169
175
|
simplecov-html (~> 0.10.0)
|
170
176
|
simplecov-html (0.10.0)
|
171
|
-
slack-notifier (2.
|
177
|
+
slack-notifier (2.1.0)
|
172
178
|
sprockets (3.7.1)
|
173
179
|
concurrent-ruby (~> 1.0)
|
174
180
|
rack (> 1, < 3)
|
@@ -177,21 +183,21 @@ GEM
|
|
177
183
|
activesupport (>= 4.0)
|
178
184
|
sprockets (>= 3.0.0)
|
179
185
|
sqlite3 (1.3.13)
|
180
|
-
term-ansicolor (1.
|
186
|
+
term-ansicolor (1.5.0)
|
181
187
|
tins (~> 1.0)
|
182
188
|
thor (0.19.4)
|
183
|
-
thread_safe (0.3.
|
189
|
+
thread_safe (0.3.6)
|
184
190
|
timecop (0.8.1)
|
185
|
-
tins (1.13.
|
186
|
-
tzinfo (1.2.
|
191
|
+
tins (1.13.2)
|
192
|
+
tzinfo (1.2.3)
|
187
193
|
thread_safe (~> 0.1)
|
188
194
|
uniform_notifier (1.10.0)
|
189
|
-
warden (1.2.
|
195
|
+
warden (1.2.7)
|
190
196
|
rack (>= 1.0)
|
191
|
-
websocket-driver (0.6.
|
197
|
+
websocket-driver (0.6.5)
|
192
198
|
websocket-extensions (>= 0.1.0)
|
193
199
|
websocket-extensions (0.1.2)
|
194
|
-
yard (0.9.
|
200
|
+
yard (0.9.8)
|
195
201
|
yard-activesupport-concern (0.0.1)
|
196
202
|
yard (>= 0.8)
|
197
203
|
|
@@ -204,18 +210,19 @@ DEPENDENCIES
|
|
204
210
|
aws-sdk (~> 2)
|
205
211
|
bullet
|
206
212
|
coveralls
|
207
|
-
devise (~> 4.2.
|
213
|
+
devise (~> 4.2.1)
|
208
214
|
dotenv-rails
|
209
215
|
factory_girl_rails (~> 4.8.0)
|
210
|
-
|
216
|
+
mongoid (>= 4.0.0)
|
217
|
+
rails (~> 5.0)
|
211
218
|
rails-controller-testing
|
212
219
|
rspec-rails (~> 3.5.1)
|
213
|
-
simplecov (~> 0.
|
220
|
+
simplecov (~> 0.14.1)
|
214
221
|
slack-notifier (>= 1.5.1)
|
215
222
|
sqlite3 (~> 1.3.13)
|
216
223
|
timecop
|
217
|
-
yard (~> 0.9.
|
224
|
+
yard (~> 0.9.8)
|
218
225
|
yard-activesupport-concern (~> 0.0.1)
|
219
226
|
|
220
227
|
BUNDLED WITH
|
221
|
-
1.
|
228
|
+
1.14.6
|
data/README.md
CHANGED
@@ -10,13 +10,14 @@
|
|
10
10
|
|
11
11
|
`activity_notification` provides integrated user activity notifications for Ruby on Rails. You can easily use it to configure multiple notification targets and make activity notifications with notifiable models, like adding comments, responding etc.
|
12
12
|
|
13
|
-
`activity_notification` supports Rails 5.0 and 4.2+.
|
13
|
+
`activity_notification` supports Rails 5.0 and 4.2+. Also, it is supported with ActiveRecord and [Mongoid](http://mongoid.org) ORM.
|
14
14
|
|
15
15
|
|
16
16
|
## About
|
17
17
|
|
18
18
|
`activity_notification` provides following functions:
|
19
19
|
* Notification API (creating notifications, query for notifications and managing notification parameters)
|
20
|
+
* Notification models (stored with ActiveRecord or [Mongoid](http://mongoid.org) ORM)
|
20
21
|
* Notification controllers (managing open/unopen of notifications, link to notifiable activity page)
|
21
22
|
* Notification views (presentation of notifications)
|
22
23
|
* Grouping notifications (grouping like `"Kevin and 7 other users posted comments to this article"`)
|
@@ -43,46 +44,48 @@
|
|
43
44
|
|
44
45
|
## Table of contents
|
45
46
|
|
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
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
47
|
+
- [About](#about)
|
48
|
+
- [Setup](#setup)
|
49
|
+
- [Gem installation](#gem-installation)
|
50
|
+
- [Database setup](#database-setup)
|
51
|
+
- [Using ActiveRecord ORM](#using_activerecord_orm)
|
52
|
+
- [Using Mongoid ORM](#using_mongoid_orm)
|
53
|
+
- [Configuring models](#configuring-models)
|
54
|
+
- [Configuring target model](#configuring-target-model)
|
55
|
+
- [Configuring notifiable model](#configuring-notifiable-model)
|
56
|
+
- [Configuring views](#configuring-views)
|
57
|
+
- [Configuring controllers](#configuring-controllers)
|
58
|
+
- [Configuring routes](#configuring-routes)
|
59
|
+
- [Creating notifications](#creating-notifications)
|
60
|
+
- [Displaying notifications](#displaying-notifications)
|
61
|
+
- [Preparing target notifications](#preparing-target-notifications)
|
62
|
+
- [Rendering notifications](#rendering-notifications)
|
63
|
+
- [Notification views](#notification-views)
|
64
|
+
- [i18n for notifications](#i18n-for-notifications)
|
65
|
+
- [Functions](#functions)
|
66
|
+
- [Email notification](#email-notification)
|
67
|
+
- [Mailer setup](#mailer-setup)
|
68
|
+
- [Email templates](#email-templates)
|
69
|
+
- [i18n for email](#i18n-for-email)
|
70
|
+
- [Batch email notification](#batch-email-notification)
|
71
|
+
- [Batch mailer setup](#batch-mailer-setup)
|
72
|
+
- [Batch email templates](#batch-email-templates)
|
73
|
+
- [i18n for batch email](#i18n-for-batch-email)
|
74
|
+
- [Grouping notifications](#grouping-notifications)
|
75
|
+
- [Subscription management](#subscription-management)
|
76
|
+
- [Configuring subscriptions](#configuring-subscriptions)
|
77
|
+
- [Managing subscriptions](#managing-subscriptions)
|
78
|
+
- [Customizing subscriptions](#customizing-subscriptions)
|
79
|
+
- [Integration with Devise](#integration-with-devise)
|
80
|
+
- [Optional notification targets](#optional-notification-targets)
|
81
|
+
- [Configuring optional targets](#configuring-optional-targets)
|
82
|
+
- [Customizing message format](#customizing-message-format)
|
83
|
+
- [Amazon SNS as optional target](#amazon-sns-as-optional-target)
|
84
|
+
- [Slack as optional target](#slack-as-optional-target)
|
85
|
+
- [Developing custom optional targets](#developing-custom-optional-targets)
|
86
|
+
- [Testing](#testing)
|
87
|
+
- [Documentation](#documentation)
|
88
|
+
- **[Common examples](#common-examples)**
|
86
89
|
|
87
90
|
|
88
91
|
## Setup
|
@@ -111,14 +114,32 @@ It also generates a i18n based translation file which we can configure the prese
|
|
111
114
|
|
112
115
|
### Database setup
|
113
116
|
|
114
|
-
|
115
|
-
|
117
|
+
#### Using ActiveRecord ORM
|
118
|
+
|
119
|
+
When you use `activity_notification` with ActiveRecord ORM as default configuration,
|
120
|
+
create migration for notifications and migrate the database in your Rails project:
|
116
121
|
|
117
122
|
```console
|
118
123
|
$ bin/rails generate activity_notification:migration
|
119
124
|
$ bin/rake db:migrate
|
120
125
|
```
|
121
126
|
|
127
|
+
#### Using Mongoid ORM
|
128
|
+
|
129
|
+
When you use `activity_notification` with [Mongoid](http://mongoid.org) ORM, set `AN_ORM` environment variable to `mongoid`:
|
130
|
+
|
131
|
+
```console
|
132
|
+
$ export AN_ORM=mongoid
|
133
|
+
```
|
134
|
+
|
135
|
+
You can also configure ORM in initializer `activity_notification.rb`:
|
136
|
+
|
137
|
+
```ruby
|
138
|
+
config.orm = :mongoid
|
139
|
+
```
|
140
|
+
|
141
|
+
You need to configure Mongoid in your Rails application for your MongoDB environment. Then, your notifications and subscriptions will be stored in your MongoDB.
|
142
|
+
|
122
143
|
### Configuring models
|
123
144
|
|
124
145
|
#### Configuring target model
|