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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +15 -5
  3. data/CHANGELOG.md +13 -2
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +78 -71
  6. data/README.md +64 -43
  7. data/activity_notification.gemspec +5 -4
  8. data/app/controllers/activity_notification/notifications_controller.rb +1 -1
  9. data/app/controllers/activity_notification/subscriptions_controller.rb +1 -1
  10. data/gemfiles/Gemfile.rails-4.2 +1 -1
  11. data/gemfiles/Gemfile.rails-4.2.lock +71 -62
  12. data/gemfiles/Gemfile.rails-5.0 +1 -1
  13. data/gemfiles/Gemfile.rails-5.0.lock +74 -67
  14. data/lib/activity_notification.rb +9 -2
  15. data/lib/activity_notification/apis/notification_api.rb +142 -76
  16. data/lib/activity_notification/apis/subscription_api.rb +72 -0
  17. data/lib/activity_notification/config.rb +12 -0
  18. data/lib/activity_notification/models/concerns/notifiable.rb +56 -6
  19. data/lib/activity_notification/models/concerns/notifier.rb +8 -1
  20. data/lib/activity_notification/models/concerns/subscriber.rb +13 -10
  21. data/lib/activity_notification/models/concerns/target.rb +7 -5
  22. data/lib/activity_notification/models/notification.rb +2 -270
  23. data/lib/activity_notification/models/subscription.rb +3 -101
  24. data/lib/activity_notification/optional_targets/base.rb +5 -1
  25. data/lib/activity_notification/orm/active_record.rb +16 -0
  26. data/lib/activity_notification/orm/active_record/notification.rb +252 -0
  27. data/lib/activity_notification/orm/active_record/subscription.rb +52 -0
  28. data/lib/activity_notification/orm/mongoid.rb +63 -0
  29. data/lib/activity_notification/orm/mongoid/notification.rb +255 -0
  30. data/lib/activity_notification/orm/mongoid/subscription.rb +73 -0
  31. data/lib/activity_notification/rails/routes.rb +7 -3
  32. data/lib/activity_notification/renderable.rb +5 -1
  33. data/lib/activity_notification/roles/acts_as_notifiable.rb +4 -18
  34. data/lib/activity_notification/version.rb +1 -1
  35. data/lib/generators/activity_notification/install_generator.rb +3 -5
  36. data/lib/generators/templates/activity_notification.rb +9 -4
  37. data/spec/concerns/apis/notification_api_spec.rb +27 -14
  38. data/spec/concerns/models/notifiable_spec.rb +10 -8
  39. data/spec/concerns/models/subscriber_spec.rb +12 -12
  40. data/spec/concerns/models/target_spec.rb +61 -51
  41. data/spec/controllers/subscriptions_controller_shared_examples.rb +0 -1
  42. data/spec/helpers/view_helpers_spec.rb +24 -7
  43. data/spec/models/notification_spec.rb +63 -52
  44. data/spec/models/subscription_spec.rb +6 -3
  45. data/spec/optional_targets/amazon_sns_spec.rb +8 -5
  46. data/spec/optional_targets/base_spec.rb +3 -1
  47. data/spec/optional_targets/slack_spec.rb +5 -5
  48. data/spec/rails_app/app/models/comment.rb +1 -1
  49. data/spec/rails_app/app/views/activity_notification/notifications/users/overriden/custom/_test.html.erb +1 -0
  50. data/spec/rails_app/config/application.rb +7 -0
  51. data/spec/rails_app/config/initializers/activity_notification.rb +5 -0
  52. data/spec/rails_app/config/mongoid.yml +13 -0
  53. data/spec/rails_app/db/seeds.rb +1 -1
  54. data/spec/rails_app/lib/custom_optional_targets/console_output.rb +7 -4
  55. data/spec/rails_app/lib/custom_optional_targets/wrong_target.rb +3 -0
  56. data/spec/roles/acts_as_notifiable_spec.rb +77 -16
  57. data/spec/spec_helper.rb +7 -0
  58. metadata +38 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10573a031431162243ea0c47762d6a23f2a1c5fc
4
- data.tar.gz: 9d79ff21207045e1f8adb3c6154749b25f4cfbfc
3
+ metadata.gz: e179e93cf2ac56df97de6634905fa1167b46ed6c
4
+ data.tar.gz: 1ee6aa961fcaf36d1b57d51b6eb984b4994c0b1a
5
5
  SHA512:
6
- metadata.gz: 099d83aa693ea68f03ea346bc8d58f9ad03f812dd28b78ddd11e4ca31c18424949a3e1abe36ef5da77b1d8c39097211b5ca58dd852855bff831809801c179af7
7
- data.tar.gz: c388ceeae7685591b3e8585efcf6ec597e5a7a343b48f42b4ad1d9bf960c3a31a17397e7071b9b95855df42cb653ee174642313edcff914a28444d22a3dfdc18
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
9
- - 2.2.5
10
- - 2.3.1
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.9
25
+ - rvm: 2.1.10
21
26
  gemfile: gemfiles/Gemfile.rails-5.0
22
- - rvm: 2.1.9
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 :slack_name initializing parameter and template parameter of default Slack optional target to :target_username
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
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'rails', '~> 5.0.0'
5
+ gem 'rails', '~> 5.0'
6
6
 
7
7
  group :development do
8
8
  gem 'bullet'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activity_notification (1.2.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.1)
14
- actionpack (= 5.0.1)
15
- nio4r (~> 1.2)
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.1)
18
- actionpack (= 5.0.1)
19
- actionview (= 5.0.1)
20
- activejob (= 5.0.1)
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.1)
24
- actionview (= 5.0.1)
25
- activesupport (= 5.0.1)
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.1)
31
- activesupport (= 5.0.1)
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.2)
36
- activejob (5.0.1)
37
- activesupport (= 5.0.1)
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.1)
40
- activesupport (= 5.0.1)
41
- activerecord (5.0.1)
42
- activemodel (= 5.0.1)
43
- activesupport (= 5.0.1)
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.1)
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.6.44)
56
- aws-sdk-resources (= 2.6.44)
57
- aws-sdk-core (2.6.44)
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.6.44)
61
- aws-sdk-core (= 2.6.44)
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
- builder (3.2.2)
65
- bullet (5.5.0)
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.4)
69
- coveralls (0.8.17)
69
+ concurrent-ruby (1.0.5)
70
+ coveralls (0.8.20)
70
71
  json (>= 1.8, < 3)
71
- simplecov (~> 0.12.0)
72
+ simplecov (~> 0.14.1)
72
73
  term-ansicolor (~> 1.3)
73
- thor (~> 0.19.1)
74
+ thor (~> 0.19.4)
74
75
  tins (~> 1.6)
75
- devise (4.2.0)
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.2.5)
82
+ diff-lcs (1.3)
82
83
  docile (1.1.5)
83
- dotenv (2.1.1)
84
- dotenv-rails (2.1.1)
85
- dotenv (= 2.1.1)
86
- railties (>= 4.0, < 5.1)
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.7.0)
96
+ i18n (0.8.1)
96
97
  jmespath (1.3.1)
97
- jquery-rails (4.2.2)
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.2)
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
- nio4r (1.2.1)
113
- nokogiri (1.7.0.1)
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.1)
120
- actioncable (= 5.0.1)
121
- actionmailer (= 5.0.1)
122
- actionpack (= 5.0.1)
123
- actionview (= 5.0.1)
124
- activejob (= 5.0.1)
125
- activemodel (= 5.0.1)
126
- activerecord (= 5.0.1)
127
- activesupport (= 5.0.1)
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.1)
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.1)
141
- actionpack (= 5.0.1)
142
- activesupport (= 5.0.1)
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.12.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.0.0)
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.4.0)
186
+ term-ansicolor (1.5.0)
181
187
  tins (~> 1.0)
182
188
  thor (0.19.4)
183
- thread_safe (0.3.5)
189
+ thread_safe (0.3.6)
184
190
  timecop (0.8.1)
185
- tins (1.13.0)
186
- tzinfo (1.2.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.6)
195
+ warden (1.2.7)
190
196
  rack (>= 1.0)
191
- websocket-driver (0.6.4)
197
+ websocket-driver (0.6.5)
192
198
  websocket-extensions (>= 0.1.0)
193
199
  websocket-extensions (0.1.2)
194
- yard (0.9.5)
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.0)
213
+ devise (~> 4.2.1)
208
214
  dotenv-rails
209
215
  factory_girl_rails (~> 4.8.0)
210
- rails (~> 5.0.0)
216
+ mongoid (>= 4.0.0)
217
+ rails (~> 5.0)
211
218
  rails-controller-testing
212
219
  rspec-rails (~> 3.5.1)
213
- simplecov (~> 0.12.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.5)
224
+ yard (~> 0.9.8)
218
225
  yard-activesupport-concern (~> 0.0.1)
219
226
 
220
227
  BUNDLED WITH
221
- 1.12.5
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+. Currently, it is only supported with ActiveRecord ORM.
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
- 1. [About](#about)
47
- 2. [Setup](#setup)
48
- 1. [Gem installation](#gem-installation)
49
- 2. [Database setup](#database-setup)
50
- 3. [Configuring models](#configuring-models)
51
- 1. [Configuring target model](#configuring-target-model)
52
- 2. [Configuring notifiable model](#configuring-notifiable-model)
53
- 4. [Configuring views](#configuring-views)
54
- 5. [Configuring controllers](#configuring-controllers)
55
- 6. [Configuring routes](#configuring-routes)
56
- 7. [Creating notifications](#creating-notifications)
57
- 8. [Displaying notifications](#displaying-notifications)
58
- 1. [Preparing target notifications](#preparing-target-notifications)
59
- 2. [Rendering notifications](#rendering-notifications)
60
- 3. [Notification views](#notification-views)
61
- 4. [i18n for notifications](#i18n-for-notifications)
62
- 3. [Functions](#functions)
63
- 1. [Email notification](#email-notification)
64
- 1. [Mailer setup](#mailer-setup)
65
- 2. [Email templates](#email-templates)
66
- 3. [i18n for email](#i18n-for-email)
67
- 2. [Batch email notification](#batch-email-notification)
68
- 1. [Batch mailer setup](#batch-mailer-setup)
69
- 2. [Batch email templates](#batch-email-templates)
70
- 3. [i18n for batch email](#i18n-for-batch-email)
71
- 3. [Grouping notifications](#grouping-notifications)
72
- 4. [Subscription management](#subscription-management)
73
- 1. [Configuring subscriptions](#configuring-subscriptions)
74
- 2. [Managing subscriptions](#managing-subscriptions)
75
- 3. [Customizing subscriptions](#customizing-subscriptions)
76
- 5. [Integration with Devise](#integration-with-devise)
77
- 6. [Optional notification targets](#optional-notification-targets)
78
- 1. [Configuring optional targets](#configuring-optional-targets)
79
- 2. [Customizing message format](#customizing-message-format)
80
- 3. [Amazon SNS as optional target](#amazon-sns-as-optional-target)
81
- 4. [Slack as optional target](#slack-as-optional-target)
82
- 5. [Developing custom optional targets](#developing-custom-optional-targets)
83
- 4. [Testing](#testing)
84
- 5. [Documentation](#documentation)
85
- 6. **[Common examples](#common-examples)**
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
- Currently `activity_notification` is only supported with ActiveRecord.
115
- Create migration for notifications and migrate the database in your Rails project:
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