Skip to content
maccman edited this page Sep 13, 2010 · 3 revisions

You can use anything you like as a model – a plain Ruby class, ActiveRecord with Sqlite3 or SuperModel.

SuperModel is Bowline’s default option, due to the fact that using ActiveRecord is often overkill for Bowline projects. SuperModel stores all the app’s data in-memory, which you can usually afford to do if the data isn’t large.

Generating models

You can generate a model using bowline-gen, e.g:
bowline-gen model tweet

This will generate a model in:
app/models/tweet.rb

SuperModel

SuperModel is an in-memory database library. It’s built on top of ActiveModel – so you get all the benefits, such as Callbacks, Observers, Validation and even Associations. Check out the library’s README for more information.

Persistance

SuperModel can marshal your model data to disk, persisting it. To enable this, just include the SuperModel::Marshal::Model module, e.g.:

class Tweet < SuperModel::Base
include SuperModel::Marshal::Model
end