stream_rails 2.1 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/stream_rails/feed_manager.rb +9 -5
- data/lib/stream_rails/version.rb +1 -1
- data/lib/stream_rails.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70c5b22ea342a9c2caa66521fcb38dd70adfcc14
|
4
|
+
data.tar.gz: 9cb603fa72c135002d2243d36d7134a8669e90c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f32e2070d44937683e0ee1b7367fc12ac74d24012d9eca6e5f8d135702b71d63bdbea792ebdfc302b83f9e91af7ab8b25b13a92630c8e91ea3148c94fe3ac8b
|
7
|
+
data.tar.gz: a690422094cc32d3254e125a7a105b7e60724de99e56cd361aada66f8441e13ba888946506ee15bb0f9056718b0cf9f8d162cac82288ec17e1f25401de6e56eb
|
data/README.md
CHANGED
@@ -287,4 +287,12 @@ eg. adds the extra_var to the partial scope
|
|
287
287
|
<%= render_activity activity, :locals => {:extra_var => 42} %>
|
288
288
|
```
|
289
289
|
|
290
|
+
### Disable model tracking
|
290
291
|
|
292
|
+
You can disable model tracking (eg. when you run tests) via StreamRails.configure
|
293
|
+
|
294
|
+
```
|
295
|
+
require 'stream_rails'
|
296
|
+
|
297
|
+
StreamRails.enabled = false
|
298
|
+
```
|
@@ -47,14 +47,18 @@ module StreamRails
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def created_activity(instance)
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
if StreamRails::enabled?
|
51
|
+
activity = instance.create_activity
|
52
|
+
feed = self.get_owner_feed(instance)
|
53
|
+
feed.add_activity(activity)
|
54
|
+
end
|
53
55
|
end
|
54
56
|
|
55
57
|
def destroyed_activity(instance)
|
56
|
-
|
57
|
-
|
58
|
+
if StreamRails::enabled?
|
59
|
+
feed = self.get_owner_feed(instance)
|
60
|
+
feed.remove(instance.activity_foreign_id, foreign_id=true)
|
61
|
+
end
|
58
62
|
end
|
59
63
|
|
60
64
|
end
|
data/lib/stream_rails/version.rb
CHANGED
data/lib/stream_rails.rb
CHANGED
@@ -22,6 +22,19 @@ module StreamRails
|
|
22
22
|
@config ||= StreamRails::Config.new
|
23
23
|
end
|
24
24
|
|
25
|
+
# Switches StreamRails on or off.
|
26
|
+
# @param value [Boolean]
|
27
|
+
def self.enabled=(value)
|
28
|
+
StreamRails.config.enabled = value
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns `true` if StreamRails is on, `false` otherwise.
|
32
|
+
# Enabled by default.
|
33
|
+
# @return [Boolean]
|
34
|
+
def self.enabled?
|
35
|
+
!!StreamRails.config.enabled
|
36
|
+
end
|
37
|
+
|
25
38
|
# Returns StreamRails's configuration object.
|
26
39
|
def self.feed_manager
|
27
40
|
@feed_manager ||= StreamRails::FeedManager.new(self.client, self.config.feed_configs)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stream_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tommaso Barbugli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|