Merge pull request #12 from skiprope/subscriptions
Fixes inability to manually subscribe to new questions because there is no subscription record
This commit is contained in:
commit
cfbed77fa3
|
@ -9,7 +9,11 @@ class Subscription < ActiveRecord::Base
|
||||||
|
|
||||||
def is_subscribed(recipient, target)
|
def is_subscribed(recipient, target)
|
||||||
existing = Subscription.find_by(user: recipient, answer: target)
|
existing = Subscription.find_by(user: recipient, answer: target)
|
||||||
existing.nil? or existing.is_active
|
if existing.nil?
|
||||||
|
false
|
||||||
|
else
|
||||||
|
existing.is_active
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def subscribe(recipient, target, force = true)
|
def subscribe(recipient, target, force = true)
|
||||||
|
|
Loading…
Reference in New Issue