Skip to content

Commit

Permalink
fixed tip model when user has been deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmike committed May 10, 2015
1 parent 1c4c1e9 commit b4d6acd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/tip.rb
Expand Up @@ -48,7 +48,7 @@ def non_refunded?

scope :with_address, -> { joins(:user).where.not('users.bitcoin_address' => [nil, ""]) }
def with_address?
user.bitcoin_address.present?
user.present? and user.bitcoin_address.present?
end

scope :decided, -> { where.not(amount: nil) }
Expand Down Expand Up @@ -83,7 +83,7 @@ def commit_url
attr_accessor :decided_free_amount

def notify_user
if amount and amount > 0 and user.bitcoin_address.blank? and !user.unsubscribed
if amount and amount > 0 and user and user.bitcoin_address.blank? and !user.unsubscribed
if user.notified_at.nil? or user.notified_at < 30.days.ago
UserMailer.new_tip(user, self).deliver
user.touch :notified_at
Expand Down

0 comments on commit b4d6acd

Please sign in to comment.