Announcing Ribs 0.0.1

I am extremely pleased to announce the first release of Ribs.

Ribs is a library for JRuby, that allows you to persist Ruby objects using Hibernate. Some time ago I wrote about ActiveHibernate. I have now decided to implement this myself, and the result is the Ribs project.

The first release is quite minimal in scope. You can define and work with models that have primitive values only – there is no support for associations. You can find, create, update and delete model objects. All of this uses Hibernate and JDBC.

To get started, you just define that an object is to be a Ribs model:

class Artist

Once that’s done, you can start working with it.

Of course, this is just the beginning. I have a quite long list of things I’d like to have in the project, but I felt the need to release quickly and often to be more important than to implement everything first.

This release is not really for production usage, but I would appreciate if people tried it out and came with suggestions. The current planned features can be found in the PLAN file, in the git repository.

More documentation can be found here:
You can download the gem at:
The git repository is at: git://

Ribs will soon be available in the regular gem repositories – as soon as my Rubyforge project has been approved.

The project is released under the MIT license.

5 Comments, Comment or Ping

  1. This is a great idea, but I found the Ribs! syntax to be confusing for 3 reasons: 1) it’s camel case, which generally means a class. 2) it’s got a bang(!), but it’s not really dangerous. I don’t want to speak for most ruby developers out there, but i think most of them don’t consider method using metaprogramming as “dangerous”. 3) defining Kernel#Ribs! seems inelegant.

    Also, passing a block to Ribs! is a bit confusing:

    class Blog
    Ribs! do |r|
    r.table :blogs

    r.primary_key :blog_id

    r.col :title, :blog_title

    r.avoid :irrelevant_column

    what’s this ‘r’ variable, and why am i defining the table name and schema on ‘r’ and not the actual class? what about this:

    class Blog
    include Ribs::Model

    table :blogs

    primary_key :blog_id
    col :title, :blog_title
    avoid :irrelevant_column


    Seems more explicit and reads better too, IMHO. Or maybe that’s the syntax I prefer b/c of DataMapper. :)

    September 1st, 2008

  2. Yeah, I knew the names I choose for methods would be a bit controversial. Using a capital R felt right, I don’t want to use a module or a class, but I basically want it to say that this is something that puts lots of functionality into the class, just like a module or class.

    The bang is there for two reasons, first, it’s definitely dangerous. It modifies the class it’s part of. That’s what I look for when I decide if I should have a bang or not. The second reason for the bang is that this allows me to have a capital letter in the word.

    I like having Kernel#Ribs!, because it’s not at all intrusive. That’s the only way to make something into a Ribs model. I generally avoid module hooks like included and append_features. I find them unintuitive and definitely against what a mixin should do.

    Finally, the reason I want to collect all the definitions in a block is because it gives me more flexibility. I don’t have to pollute the name space of the class with every method needed for definitions, and I can also do things like copy definitions between classes very easily. I can define Ribs on a metaclass if I want to.

    September 1st, 2008

  3. Also, in addition to the above, I feel that all those things would be way more inelegant if I used the approach you detail. And in fact, the reason I did it this way is because I feel that ActiveRecord and DataMapper got this totally wrong. I don’t like how it looks and the way it pollutes things for me.

    September 1st, 2008

  4. sorry to post my question here ,but i’m wondering how can u profile rails apps using jruby, is there any ruby-prof like tool in jruby?

    September 2nd, 2008

  5. Tyler

    This looks pretty cool. How would you compare it GORM, if at all?

    September 10th, 2008

Reply to “Announcing Ribs 0.0.1”