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:
Andreas N. 2015-04-21 15:28:04 +02:00
commit cfbed77fa3
1 changed files with 5 additions and 1 deletions

View File

@ -9,7 +9,11 @@ class Subscription < ActiveRecord::Base
def is_subscribed(recipient, 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
def subscribe(recipient, target, force = true)