Module: ActiveRecall::DeckMethods
- Defined in:
- lib/active_recall/deck_methods.rb
Instance Method Summary collapse
Instance Method Details
#deck ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/active_recall/deck_methods.rb', line 5 def deck d = ActiveRecall::Deck.find_or_create_by(user_id: id, user_type: self.class.name) d.source_class.module_eval do def stats ActiveRecall::Item.find_by(source_id: id, source_type: self.class.name) end end d end |
#remove_deck ⇒ Object
15 16 17 18 19 |
# File 'lib/active_recall/deck_methods.rb', line 15 def remove_deck ActiveRecall::Deck .where(user_id: id, user_type: self.class.name) .destroy_all end |