Skip to content
Okubo is a simple spaced-repetition gem for learning items, such as words in a foreign language, which you can use with your own Active Record models.
Branch: master
Clone or download
This branch is 2 commits ahead of rgravina:master.

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

Okubo Build Status Code Climate

Okubo is a simple spaced-repetition system which you can associate with Active Record models to be learned (such as words in a foreign language) and users in your system. Users study these words, and as they mark these attempts right or wrong, Okubo will determine when they should be reviewed next.

Okubo determines the next study time for an item using the Leitner System. In the future it may support other popular algorithms, such as the Supermemo 2 algorithm.


Add to Gemfile (will put on rubygems once at 0.1):

gem 'okubo', :git => "git://"


bundle install
rails generate okubo
rake db:migrate

Quick Start

Assume you have an application allowing your users to study words in a foreign language. Using the has_deck method you can set up a deck of flashcards that the user will study:

class Word < ActiveRecord::Base

class User < ActiveRecord::Base
  has_deck :words

user = User.create!(:name => "Robert")
word = Word.create!(:kanji => "日本語", :kana => "にほんご", :translation => "Japanese language")

You can add words and record attempts to guess the word as right or wrong. Various methods exist to allow you to access subsets of this collection:

# Initally adding a word
user.words << word
user.words.untested #=> [word]

# Guessing a word correctly
user.words.known #=> [word]

# Guessing a word incorrectly
user.words.failed #=> [word]

# Listing all words
user.words #=> [word]

As time passes words need to be reviewed to keep them fresh in memory:

# Three days later...
user.words.known #=> []
user.words.expired #=> [word]

Guessing a word correcly several times in a row results in the word taking longer to expire, and demonstrates mastery of that word.

# One week later...
user.words.expired #=> [word]
# Two weeks later...
user.words.expired #=> [word]
# One month later...
user.words.expired #=> [word]


In addition to an expired method, Okubo provides a suggested reviewing sequence for all unknown words in the deck. Words are randomly chosen from all untested words, failed, and finally expired in order of precedence. #=> [word]
# ... continuing until all untested, failed, and expired words have been guessed correctly. #=> []

You can also just get the next word to review: #=> word
# ... continuing until all untested, failed, and expired words have been guessed correctly. #=> nil


Chuhi is a Rails application which uses Okubo to schedule words. Have a look at the project source for real world usage. You can also use the app online!


  • activerecord-reputation-system - for providing the design and implementation from which this gem is based.
  • randym - for enouraging me work on this gem in the first place.
  • Tokyo Rails - for providing collaboration evenings where this gem was worked on.
  • Reviewing the Kanji - for providing a great visual representation and implementation of the Leitner system.

Copyright and License

Okubo © 2012 by Robert Gravina. Okubo is licensed under the MIT license. Please see the LICENSE document for more information.

You can’t perform that action at this time.