Sha256: fa043fba0b7bb212475d3f25b33e6a9704dfecbcb50525c5c47a20b7b1b8a225

Contents?: true

Size: 496 Bytes

Versions: 5

Compression:

Stored size: 496 Bytes

Contents

# frozen_string_literal: true

module ActiveRecall
  module DeckMethods
    def deck
      d = ActiveRecall::Deck.where(user_id: id, user_type: self.class.name).first_or_create
      d.source_class.module_eval do
        def stats
          ActiveRecall::Item.where(source_id: id, source_type: self.class.name).first
        end
      end
      d
    end

    def remove_deck
      ActiveRecall::Deck
        .where(user_id: id, user_type: self.class.name)
        .destroy_all
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_recall-1.5.0 lib/active_recall/deck_methods.rb
active_recall-1.4.0 lib/active_recall/deck_methods.rb
active_recall-1.3.0 lib/active_recall/deck_methods.rb
active_recall-1.2.2 lib/active_recall/deck_methods.rb
active_recall-1.2.1 lib/active_recall/deck_methods.rb