RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

MiniRecord: ActiveRecord without Migrations!!

Sometimes I prefer to use DataMapper because it’s faster and cleaner write “schema” directly inside models, unfortunately my co-workers are too lazy to study a bit DM. So I started to write a small plugin for ActiveRecord 3.1 that replicate this awesome feature. Try MiniRecord!!!.

Comments

Correct me if I’m wrong but isn’t this contrary to the active record pattern? http://en.wikipedia.org/wiki/Active_record_pattern

Is it possible to use this in a one off basis? For example, I want a rails application to work like normal with migrations and everything. But I also have a small “utility app” within this main rails app using a separate sqlite db, and it would be nice to specify the structure using this, without effecting the main application.

@bcardarella, yep a bit, the intended usage is for tiny app or for testing purpose. Think to write only a library not a website, it’s not useful have separate migrations. IMHO.

@Randy, yep!

@DAddYEz, Thanks. Another question:

“What you need is to move/remove db/migrations and db/schema.rb. It’s no more necessary and it avoid conflicts.”

In my example above, this would not be feasible. Would I want to do this anyway?

@bcardarella don’t see why it particularly matters. It’s not like an app has to follow one design pattern to-the-bone. I personally prefer ActiveRecord’s query interface to DataMapper’s just because I’m more familiar to it. I don’t see how the query interface’s functionality depends on migrations to function.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in