acts_as_pushable 0.1.1 → 0.2.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 +2 -1
- data/lib/acts_as_pushable/pushable.rb +9 -1
- data/lib/acts_as_pushable/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3cf52438238f0a1ecc519c79d1e0c109e2aa3b3
|
4
|
+
data.tar.gz: e0050a1abd40c76018e755af5c972c6df8949c03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85e0b91b69df6f7b34a3dbf0acdccf8e5ab1ffa6e6a3ada051fe55edd6dd953e616dff1f1957d8409bffddeeb7909ab3272c04ca1249679138813edfcfd122a6
|
7
|
+
data.tar.gz: 775bf5cd462bceaad998e312409039f5942e294b9ee76359f931f8b767380e4946e99d1cc6c35e4e23ce88747e619e9e2aaf923a2fcc272e0edaa872cb701129
|
data/README.md
CHANGED
@@ -25,7 +25,8 @@ or just install it -
|
|
25
25
|
Run the generator to create the migrations and initializer template -
|
26
26
|
|
27
27
|
```shell
|
28
|
-
rails generate act_as_pushable
|
28
|
+
rails generate act_as_pushable:install
|
29
|
+
rake db:migrate
|
29
30
|
```
|
30
31
|
|
31
32
|
This a file at `config/initializers/acts_as_pushable.rb` that you can modify to match your settings. Follow the quick start guides for the platforms that you want to support.
|
@@ -21,12 +21,20 @@ module ActsAsPushable
|
|
21
21
|
|
22
22
|
def add_device(device_params)
|
23
23
|
device = build_device(device_params)
|
24
|
-
device.save
|
24
|
+
if device.save
|
25
|
+
return device
|
26
|
+
else
|
27
|
+
device.errors.each do |attribute, message|
|
28
|
+
errors.add(:devices, "#{attribute} #{message}")
|
29
|
+
end
|
30
|
+
return false
|
31
|
+
end
|
25
32
|
end
|
26
33
|
|
27
34
|
def add_device!(device_params)
|
28
35
|
device = build_device(device_params)
|
29
36
|
device.save!
|
37
|
+
return device
|
30
38
|
end
|
31
39
|
|
32
40
|
def send_push_notification(title:, message:, **options)
|