Class: User

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/user.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.notify_reviewObject


23
24
25
26
27
# File 'app/models/user.rb', line 23

def self.notify_review
  User.includes(decks: :cards).each do |user|
    NotificationsMailer.pending_cards(user).deliver_later
  end
end

Instance Method Details

#cardsObject


15
16
17
# File 'app/models/user.rb', line 15

def cards
  Card.where(deck_id: decks)
end

#cards_for_reviewObject


19
20
21
# File 'app/models/user.rb', line 19

def cards_for_review
  default_deck ? default_deck.cards.for_review : cards.for_review
end