Sha256: 14770791ec2a43691dd2b29b6431e54dd191437fe5918c3af891d11ccbdd28ea

Contents?: true

Size: 488 Bytes

Versions: 14

Compression:

Stored size: 488 Bytes

Contents

# frozen_string_literal: true

module ActiveRecall
  module DeckMethods
    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

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
active_recall-2.1.0 lib/active_recall/deck_methods.rb
active_recall-2.0.2 lib/active_recall/deck_methods.rb
active_recall-2.0.1 lib/active_recall/deck_methods.rb
active_recall-2.0.0 lib/active_recall/deck_methods.rb
active_recall-1.8.6 lib/active_recall/deck_methods.rb
active_recall-1.8.5 lib/active_recall/deck_methods.rb
active_recall-1.8.4 lib/active_recall/deck_methods.rb
active_recall-1.8.3 lib/active_recall/deck_methods.rb
active_recall-1.8.0 lib/active_recall/deck_methods.rb
active_recall-1.6.4 lib/active_recall/deck_methods.rb
active_recall-1.6.3 lib/active_recall/deck_methods.rb
active_recall-1.6.2 lib/active_recall/deck_methods.rb
active_recall-1.6.1 lib/active_recall/deck_methods.rb
active_recall-1.6.0 lib/active_recall/deck_methods.rb