live_record 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/live_record/channel.rb +5 -1
- data/lib/live_record/model.rb +1 -1
- data/lib/live_record/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: c0ded9cf6593200ae2c6ebc9456ab7e3d9b8080e
|
4
|
+
data.tar.gz: 0add3af822b794c8e002ff16afcff59051fea5cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20e77e4a34688bc6513e9eac13a00e60790b4a96d82ba5f9fd3b6057c368c2d9c1a2a12a719c0dee810562a5c4be2353141a9470ad7d4d44235f5058192ebafa
|
7
|
+
data.tar.gz: d18db364eadaedb3ed37a72cd9e163ae169aa5f694d508897670e0fce13d435115e0abda7aae9948ebe58e832d9234b3905da2e335409c1075692462125a91bf
|
data/README.md
CHANGED
@@ -62,7 +62,7 @@
|
|
62
62
|
end
|
63
63
|
```
|
64
64
|
|
65
|
-
* whenever a Book (or any other Model record that you specified) has been updated / destroyed, there exists an `after_update_commit` and an `
|
65
|
+
* whenever a Book (or any other Model record that you specified) has been updated / destroyed, there exists an `after_update_commit` and an `after_destroy_commit` ActiveRecord callback that will broadcast changes to all subscribed JS clients
|
66
66
|
|
67
67
|
## Setup
|
68
68
|
* Add the following to your `Gemfile`:
|
data/lib/live_record/channel.rb
CHANGED
@@ -9,7 +9,11 @@ module LiveRecord
|
|
9
9
|
|
10
10
|
if authorised_attributes.present?
|
11
11
|
stream_for record, coder: ActiveSupport::JSON do |message|
|
12
|
-
|
12
|
+
begin
|
13
|
+
record.reload
|
14
|
+
rescue ActiveRecord::RecordNotFound
|
15
|
+
end
|
16
|
+
|
13
17
|
authorised_attributes = authorised_attributes(record, current_user)
|
14
18
|
|
15
19
|
if authorised_attributes.present?
|
data/lib/live_record/model.rb
CHANGED
@@ -7,7 +7,7 @@ module LiveRecord
|
|
7
7
|
|
8
8
|
after_update :__live_record_reference_changed_attributes__
|
9
9
|
after_update_commit :__live_record_broadcast_record_update__
|
10
|
-
|
10
|
+
after_destroy_commit :__live_record_broadcast_record_destroy__
|
11
11
|
|
12
12
|
def self.live_record_whitelisted_attributes(record, current_user)
|
13
13
|
[]
|
data/lib/live_record/version.rb
CHANGED