subscribable 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/subscribable/relation_assigner.rb +2 -2
- data/lib/subscribable/version.rb +1 -1
- data/spec/actor_spec.rb +8 -0
- metadata +1 -1
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
This is a basic gem that allows different models to
|
4
4
|
subscribe/follow each other.
|
5
5
|
|
6
|
-
This gem is supported by American Honors. (http://
|
6
|
+
This gem is supported by American Honors. (http://americanhonors.org)
|
7
7
|
|
8
8
|
## Example: A model instance can subscribe to another model instance
|
9
9
|
|
@@ -68,7 +68,7 @@ module Subscribable
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def subscriptions_query(method_name, class_name)
|
71
|
-
self.class.define_method
|
71
|
+
self.class.send(:define_method, method_name) do
|
72
72
|
Subscribable::SubRelation.where(
|
73
73
|
subscriber_id: self.id,
|
74
74
|
subscriber_type: self.class.name,
|
@@ -78,7 +78,7 @@ module Subscribable
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def subscribers_query(method_name, class_name)
|
81
|
-
self.class.define_method
|
81
|
+
self.class.send(:define_method, method_name) do
|
82
82
|
Subscribable::SubRelation.where(
|
83
83
|
subscription_type: self.class.name,
|
84
84
|
subscription_id: self.id,
|
data/lib/subscribable/version.rb
CHANGED
data/spec/actor_spec.rb
CHANGED
@@ -13,6 +13,14 @@ describe 'Actor' do
|
|
13
13
|
expect( actor.respond_to?(:actor_subscriptions) ).to be_true
|
14
14
|
end
|
15
15
|
|
16
|
+
it 'can call actor_subscribers' do
|
17
|
+
expect( actor.actor_subscribers ).to eq([])
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'can call actor_subscriptions' do
|
21
|
+
expect( actor.actor_subscriptions ).to eq([])
|
22
|
+
end
|
23
|
+
|
16
24
|
it 'has subscriptions' do
|
17
25
|
expect{ actor.subscriptions }.to_not raise_error(NoMethodError)
|
18
26
|
end
|