RubyFlow The Ruby and Rails community linklog

How to use ActiveRecord in a library

Ever wanted to use ActiveRecord in a pure Ruby library/gem, not in a Rails app or Rails Engine? In this blog post I walk through how to accomplish this and some of the gotchas which I encountered along the way. Covers how to connect to the database, define models, “connect” the models to the database, and how to run a directory of migrations, all without Rails. Example source code is also available on GitHub.

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