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