Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Need to add a news feed to your application? EXTRA! EXTRA! is just the Gem for you!

tag: v0.2.0

Fetching latest commit…

Cannot retrieve the latest commit at this time



Need to add a news feed to your application? EXTRA! EXTRA! is just the Gem for you! This is a common need for many social applications. EXTRA! EXTRA! uses MongoDB to give you super fast, super convenient feeds.

Quick Note

Not all of this works yet. This is just a prerelease. README driven development FTW!


EXTRA! EXTRA! will be distributed via Rubygems, so just

$ gem install extraextra

and you'll be reading the news in no time!


The source of EXTRA! EXTRA! is on GitHub, and can be found here:

It can be cloned via

$ git clone git://


  • Ruby-1.9 Sorry for you 1.8 people, 1.9 is the current version of Ruby.

I test with 1.9.2.

  • mongo If you're going to use MongoDB…


The first thing you'll need to do is configure EXTRA! EXTRA! to connect to your MongoDB:

Extra::Extra.source :host => "localhost", :port => "1337"

To record something newsworthy, just do this:

$ Extra::Extra::! :breaking, user, "has just done something awesome!"

To find out what interesting things a particular user has done:

$ Extra::Extra.read_all_about_it user


$ Extra::Extra.the_scoop user

This returns an array of Extra objects. To find out more about a particular Extra:

$ extra = Extra::Extra::! :sports, user, "hit a home run!"

$ extra.who
 => #<User:0x0000010089ea80> 
$ extra.what
 => "hit a home run"
$ extra.where
 => nil # currently undecided
$ extra.when
 => 1283311813 
 => nil # currently undecided
$ extra.to_s
 => "Steve hit a home run"

Two things: 'who' instantiates the object by sending it the find message, passing an id. So that has to be defined in your user object. Secondly, the name in to_s comes from user#username. If you use something else… I'll provide a way to override these eventually.

To only see breaking news:

$ user.breaking_news

This will filter out only the news in the 'breaking' category.

To find out what interesting things a users's friends have done:

$ user.scope_the_scene

To define what who you're friends with, make a method on your user model named my_peeps. For a (hypothetical) example:

class User
  def my_peeps

The my_peeps method should return an Array of ids. This method will be called during scope_the_scene to determine what results get returned.

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.


Copyright © 2010 Steve Klabnik. See LICENSE for details.

Something went wrong with that request. Please try again.