Wynn Netherland changelog.com/posts

mini_record brings schema declarations back to your model

From Davide D’Agostino, mini_record brings schema declarations back to your ActiveRecord models in the style of DataMapper, MongoMapper, and others:

class Post < ActiveRecord::Base
  key :title
  key :permalink, :index => true, :limit => 50
  key :comments_count, :as => :integer
  key :category, :as => :references, :index => true
end
Post.auto_upgrade!
when you execute MyModel.auto_upgrade!, missing columns, indexes and tables will be created on the fly. Indexes and columns present in the db but not in your model schema will be deleted* also in your db.

Don’t go installing in your production apps just yet. Check out the extensive README for advanced usage.


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00