notification-handler 1.2.6 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -57
- data/app/models/notification_handler/notification.rb +1 -1
- data/lib/generators/notification_handler/install_generator.rb +1 -1
- data/lib/generators/templates/install/initializer.rb +1 -1
- data/lib/notification-handler.rb +3 -5
- data/lib/notification_handler/configuration.rb +9 -4
- data/lib/notification_handler/engine.rb +7 -1
- data/lib/notification_handler/group.rb +10 -7
- data/lib/notification_handler/{notification_library.rb → notification_lib.rb} +11 -11
- data/lib/notification_handler/object.rb +1 -0
- data/lib/notification_handler/target.rb +1 -0
- metadata +73 -19
- data/lib/notification_handler/railtie.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2cdb58ba8f4da880b60d9443747199aac809a9fc881c52ea6d6521b02ebb1c6
|
4
|
+
data.tar.gz: 2b22c562259da40608261bd742224fc6302ba678e2536ece9c01a01a01c51d82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6eb0d2c4cc82ca45ca54d08bc4bf75aaa531d793a31109c0644345e2e00d392f84bf145b414863b835225e52a2249d64ff12df872b2698657ba6ce0b7401693
|
7
|
+
data.tar.gz: cac446fcf48614af0346f947a181be5bfbb5a2fe9f54dd3aebd7e0b231d2550d73f851fad439cf3a07565e8daa9f7278ccc9c5ddd59395b8ee82a1d8e9d50aea
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# NotificationHandler
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/notification-handler.svg)](https://badge.fury.io/rb/notification-handler)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/notification-handler.svg)](https://badge.fury.io/rb/notification-handler) ![Travis](https://travis-ci.com/jonhue/notifications-rails.svg?branch=master)
|
4
4
|
|
5
5
|
Create and modify your notifications through a simple API.
|
6
6
|
|
@@ -10,19 +10,17 @@ Create and modify your notifications through a simple API.
|
|
10
10
|
|
11
11
|
* [Installation](#installation)
|
12
12
|
* [Usage](#usage)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
* [`Notification` API](#notification-api)
|
14
|
+
* [`notification_target`](#notification_target)
|
15
|
+
* [`notification_object`](#notification_object)
|
16
|
+
* [Groups](#groups)
|
17
|
+
* [Defining a group](#defining-a-group)
|
18
|
+
* [Using a group](#using-a-group)
|
19
|
+
* [Caching](#caching)
|
20
20
|
* [Configuration](#configuration)
|
21
21
|
* [To Do](#to-do)
|
22
22
|
* [Contributing](#contributing)
|
23
|
-
|
24
|
-
* [Semantic versioning](#semantic-versioning)
|
25
|
-
* [License](#license)
|
23
|
+
* [Semantic versioning](#semantic-versioning)
|
26
24
|
|
27
25
|
---
|
28
26
|
|
@@ -42,12 +40,6 @@ Or install it yourself as:
|
|
42
40
|
|
43
41
|
$ gem install notification-handler
|
44
42
|
|
45
|
-
If you always want to be up to date fetch the latest from GitHub in your `Gemfile`:
|
46
|
-
|
47
|
-
```ruby
|
48
|
-
gem 'notification-handler', github: 'jonhue/notifications-rails'
|
49
|
-
```
|
50
|
-
|
51
43
|
Now run the generator:
|
52
44
|
|
53
45
|
$ rails g notification_handler:install
|
@@ -78,8 +70,8 @@ To store information in your `Notification` record you can use the `metadata` at
|
|
78
70
|
|
79
71
|
```ruby
|
80
72
|
notification.metadata = {
|
81
|
-
|
82
|
-
|
73
|
+
title: 'My first notification',
|
74
|
+
content: "It looks great, doesn't it?"
|
83
75
|
}
|
84
76
|
```
|
85
77
|
|
@@ -116,7 +108,7 @@ To use records of an ActiveRecord class as notification targets, add the followi
|
|
116
108
|
|
117
109
|
```ruby
|
118
110
|
class User < ApplicationRecord
|
119
|
-
|
111
|
+
notification_target
|
120
112
|
end
|
121
113
|
```
|
122
114
|
|
@@ -129,7 +121,7 @@ notifications = User.first.notifications
|
|
129
121
|
You can create a notification from a `target`:
|
130
122
|
|
131
123
|
```ruby
|
132
|
-
User.first.notify
|
124
|
+
User.first.notify(object: Recipe.first)
|
133
125
|
```
|
134
126
|
|
135
127
|
...
|
@@ -140,7 +132,7 @@ When using records of an ActiveRecord class as notification objects, add this to
|
|
140
132
|
|
141
133
|
```ruby
|
142
134
|
class Recipe < ApplicationRecord
|
143
|
-
|
135
|
+
notification_object
|
144
136
|
end
|
145
137
|
```
|
146
138
|
|
@@ -162,7 +154,7 @@ You define groups in your `NotificationHandler` configuration:
|
|
162
154
|
|
163
155
|
```ruby
|
164
156
|
NotificationHandler.configure do |config|
|
165
|
-
|
157
|
+
config.define_group :subscribers, -> { User.where(subscriber: true) }
|
166
158
|
end
|
167
159
|
```
|
168
160
|
|
@@ -170,16 +162,22 @@ When creating a notification for the group `:subscribers`, one notification will
|
|
170
162
|
|
171
163
|
```ruby
|
172
164
|
NotificationHandler.configure do |config|
|
173
|
-
|
165
|
+
config.define_group :subscribers, -> { User.where(subscriber: true) + Admin.all }
|
166
|
+
config.define_group :company_members, lambda { |company_id|
|
167
|
+
User.with_role(:member, Company.find(company_id)
|
168
|
+
}
|
174
169
|
end
|
175
170
|
```
|
176
171
|
|
172
|
+
The only requirement is that the result of evaluating the proc be Enumerable.
|
173
|
+
|
177
174
|
#### Using a group
|
178
175
|
|
179
176
|
Bulk-creation of notifications for a certain group is fairly simple:
|
180
177
|
|
181
178
|
```ruby
|
182
|
-
notification = Notification.create
|
179
|
+
notification = Notification.create(object: Recipe.first, group: :subscribers)
|
180
|
+
notification = Notification.create(object: Recipe.first, group: :company_members, group_args: 4)
|
183
181
|
```
|
184
182
|
|
185
183
|
**Note:** You are not able to set the `target` attribute when a `group` has been specified.
|
@@ -203,7 +201,7 @@ You can configure NotificationHandler by passing a block to `configure`. This ca
|
|
203
201
|
|
204
202
|
```ruby
|
205
203
|
NotificationHandler.configure do |config|
|
206
|
-
|
204
|
+
config.cache = true
|
207
205
|
end
|
208
206
|
```
|
209
207
|
|
@@ -213,7 +211,7 @@ end
|
|
213
211
|
|
214
212
|
## To Do
|
215
213
|
|
216
|
-
[
|
214
|
+
We use [GitHub projects](https://github.com/jonhue/notifications-rails/projects/2) to coordinate the work on this project.
|
217
215
|
|
218
216
|
To propose your ideas, initiate the discussion by adding a [new issue](https://github.com/jonhue/notifications-rails/issues/new).
|
219
217
|
|
@@ -225,36 +223,6 @@ We hope that you will consider contributing to NotificationHandler. Please read
|
|
225
223
|
|
226
224
|
[Learn more about contributing to this repository](https://github.com/jonhue/notifications-rails/blob/master/CONTRIBUTING.md), [Code of Conduct](https://github.com/jonhue/notifications-rails/blob/master/CODE_OF_CONDUCT.md)
|
227
225
|
|
228
|
-
### Contributors
|
229
|
-
|
230
|
-
Give the people some :heart: who are working on this project. See them all at:
|
231
|
-
|
232
|
-
https://github.com/jonhue/notifications-rails/graphs/contributors
|
233
|
-
|
234
226
|
### Semantic Versioning
|
235
227
|
|
236
228
|
NotificationHandler follows Semantic Versioning 2.0 as defined at http://semver.org.
|
237
|
-
|
238
|
-
## License
|
239
|
-
|
240
|
-
MIT License
|
241
|
-
|
242
|
-
Copyright (c) 2017 Jonas Hübotter
|
243
|
-
|
244
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
245
|
-
of this software and associated documentation files (the "Software"), to deal
|
246
|
-
in the Software without restriction, including without limitation the rights
|
247
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
248
|
-
copies of the Software, and to permit persons to whom the Software is
|
249
|
-
furnished to do so, subject to the following conditions:
|
250
|
-
|
251
|
-
The above copyright notice and this permission notice shall be included in all
|
252
|
-
copies or substantial portions of the Software.
|
253
|
-
|
254
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
255
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
256
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
257
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
258
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
259
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
260
|
-
SOFTWARE.
|
@@ -19,7 +19,7 @@ module NotificationHandler
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def create_initializer
|
22
|
-
template 'initializer.rb', 'config/initializers/
|
22
|
+
template 'initializer.rb', 'config/initializers/notification_handler.rb'
|
23
23
|
end
|
24
24
|
|
25
25
|
def create_notifications_migration_file
|
@@ -8,5 +8,5 @@ NotificationHandler.configure do |config|
|
|
8
8
|
# Groups are a powerful way to bulk-create notifications for multiple objects
|
9
9
|
# that don't necessarily have a common class.
|
10
10
|
# Learn more: https://github.com/jonhue/notifications-rails/tree/master/notification-handler#groups
|
11
|
-
# config.define_group :subscribers, User.where(subscriber: true)
|
11
|
+
# config.define_group :subscribers, -> { User.where(subscriber: true) }
|
12
12
|
end
|
data/lib/notification-handler.rb
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module NotificationHandler
|
4
|
-
|
4
|
+
require_relative 'notification_handler/configuration'
|
5
5
|
|
6
|
-
|
6
|
+
require_relative 'notification_handler/engine'
|
7
7
|
|
8
8
|
autoload :Group, 'notification_handler/group'
|
9
9
|
|
10
10
|
autoload :Target, 'notification_handler/target'
|
11
11
|
autoload :Object, 'notification_handler/object'
|
12
|
-
autoload :
|
12
|
+
autoload :NotificationLib, 'notification_handler/notification_lib'
|
13
13
|
autoload :NotificationScopes, 'notification_handler/notification_scopes'
|
14
|
-
|
15
|
-
require 'notification_handler/railtie'
|
16
14
|
end
|
@@ -1,12 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'group'
|
4
|
+
|
3
5
|
module NotificationHandler
|
4
6
|
class << self
|
5
|
-
|
7
|
+
attr_writer :configuration
|
8
|
+
|
9
|
+
def configuration
|
10
|
+
@configuration ||= Configuration.new
|
11
|
+
end
|
6
12
|
end
|
7
13
|
|
8
14
|
def self.configure
|
9
|
-
self.configuration ||= Configuration.new
|
10
15
|
yield configuration
|
11
16
|
end
|
12
17
|
|
@@ -15,12 +20,12 @@ module NotificationHandler
|
|
15
20
|
attr_accessor :cache
|
16
21
|
|
17
22
|
def initialize
|
18
|
-
@groups =
|
23
|
+
@groups = {}
|
19
24
|
@cache = false
|
20
25
|
end
|
21
26
|
|
22
27
|
def define_group(name, target_scope)
|
23
|
-
groups
|
28
|
+
groups[name.to_sym] = ::NotificationHandler::Group.new(target_scope)
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|
@@ -1,9 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'rails/
|
3
|
+
require 'rails/engine'
|
4
4
|
require 'active_record'
|
5
5
|
|
6
6
|
module NotificationHandler
|
7
7
|
class Engine < ::Rails::Engine
|
8
|
+
initializer 'notification-handler.active_record' do
|
9
|
+
ActiveSupport.on_load :active_record do
|
10
|
+
include NotificationHandler::Target
|
11
|
+
include NotificationHandler::Object
|
12
|
+
end
|
13
|
+
end
|
8
14
|
end
|
9
15
|
end
|
@@ -2,18 +2,21 @@
|
|
2
2
|
|
3
3
|
module NotificationHandler
|
4
4
|
class Group
|
5
|
-
|
6
|
-
attr_accessor :target_scope
|
5
|
+
attr_reader :target_scope
|
7
6
|
|
8
|
-
def initialize(
|
9
|
-
@name = name
|
7
|
+
def initialize(target_scope)
|
10
8
|
@target_scope = target_scope
|
11
9
|
end
|
12
10
|
|
13
11
|
def self.find_by_name(name)
|
14
|
-
NotificationHandler.configuration.groups
|
15
|
-
|
16
|
-
|
12
|
+
NotificationHandler.configuration.groups[name]
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.find_by_name!(name)
|
16
|
+
find_by_name(name) ||
|
17
|
+
raise(ArgumentError,
|
18
|
+
"Could not find a registered group for #{name}. " \
|
19
|
+
"Make sure you register it with config.define_group :#{name}")
|
17
20
|
end
|
18
21
|
end
|
19
22
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'active_support'
|
4
4
|
|
5
5
|
module NotificationHandler
|
6
|
-
module
|
6
|
+
module NotificationLib
|
7
7
|
extend ActiveSupport::Concern
|
8
8
|
|
9
9
|
included do
|
@@ -14,20 +14,21 @@ module NotificationHandler
|
|
14
14
|
|
15
15
|
serialize :metadata, Hash
|
16
16
|
attr_accessor :group
|
17
|
+
attr_accessor :group_args
|
17
18
|
|
18
19
|
belongs_to :target, polymorphic: true
|
19
20
|
belongs_to :object, polymorphic: true, optional: true
|
20
21
|
|
21
|
-
include NotificationHandler::
|
22
|
+
include NotificationHandler::NotificationLib::InstanceMethods
|
22
23
|
|
23
24
|
if defined?(NotificationRenderer)
|
24
|
-
include NotificationRenderer::
|
25
|
+
include NotificationRenderer::NotificationLib
|
25
26
|
end
|
26
27
|
if defined?(NotificationPusher)
|
27
|
-
include NotificationPusher::
|
28
|
+
include NotificationPusher::NotificationLib
|
28
29
|
end
|
29
30
|
if defined?(NotificationSettings)
|
30
|
-
include NotificationSettings::
|
31
|
+
include NotificationSettings::NotificationLib
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
@@ -45,15 +46,14 @@ module NotificationHandler
|
|
45
46
|
def create_for_group
|
46
47
|
return if group.nil?
|
47
48
|
|
48
|
-
target_scope = NotificationHandler::Group.find_by_name(group)
|
49
|
-
.
|
50
|
-
target_scope&.
|
51
|
-
notification = dup
|
49
|
+
target_scope = NotificationHandler::Group.find_by_name!(group)
|
50
|
+
.target_scope
|
51
|
+
target_scope.call(*group_args)&.each_with_index do |target, index|
|
52
|
+
notification = index.zero? ? self : dup
|
52
53
|
notification.target = target
|
53
54
|
notification.group = nil
|
54
|
-
notification.save
|
55
|
+
notification.save!
|
55
56
|
end
|
56
|
-
false
|
57
57
|
end
|
58
58
|
|
59
59
|
def cache
|
metadata
CHANGED
@@ -1,59 +1,101 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notification-handler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Hübotter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '5.
|
19
|
+
version: '5.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '5.
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5.
|
33
|
+
version: '5.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '5.
|
40
|
+
version: '5.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: railties
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '5.
|
47
|
+
version: '5.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: factory_bot
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
53
81
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
82
|
+
version: '0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
84
|
+
name: rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec-rails
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
58
100
|
requirements:
|
59
101
|
- - ">="
|
@@ -94,6 +136,20 @@ dependencies:
|
|
94
136
|
- - ">="
|
95
137
|
- !ruby/object:Gem::Version
|
96
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: sqlite3
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
97
153
|
description: Create and modify your notifications through a simple API.
|
98
154
|
email: me@jonhue.me
|
99
155
|
executables: []
|
@@ -111,10 +167,9 @@ files:
|
|
111
167
|
- lib/notification_handler/configuration.rb
|
112
168
|
- lib/notification_handler/engine.rb
|
113
169
|
- lib/notification_handler/group.rb
|
114
|
-
- lib/notification_handler/
|
170
|
+
- lib/notification_handler/notification_lib.rb
|
115
171
|
- lib/notification_handler/notification_scopes.rb
|
116
172
|
- lib/notification_handler/object.rb
|
117
|
-
- lib/notification_handler/railtie.rb
|
118
173
|
- lib/notification_handler/target.rb
|
119
174
|
homepage: https://github.com/jonhue/notifications-rails/tree/master/notification-handler
|
120
175
|
licenses:
|
@@ -135,8 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
190
|
- !ruby/object:Gem::Version
|
136
191
|
version: '0'
|
137
192
|
requirements: []
|
138
|
-
|
139
|
-
rubygems_version: 2.7.6
|
193
|
+
rubygems_version: 3.0.3
|
140
194
|
signing_key:
|
141
195
|
specification_version: 4
|
142
196
|
summary: Create and modify your notifications through a simple API
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails/railtie'
|
4
|
-
require 'active_record'
|
5
|
-
require 'active_support'
|
6
|
-
|
7
|
-
module NotificationHandler
|
8
|
-
class Railtie < Rails::Railtie
|
9
|
-
initializer 'notification-handler.active_record' do
|
10
|
-
ActiveSupport.on_load :active_record do
|
11
|
-
include NotificationHandler::Target
|
12
|
-
include NotificationHandler::Object
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|