How to use ActiveRecord in a ruby script outside Rails?

后端 未结 3 1788
南方客
南方客 2020-11-29 18:20

I have a small ruby script in which I\'d like to use ActiveRecord to easily access a database model. What is the best way to do it?

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-29 19:19

    It's worth noting that in later versions of activerecord (v3+) you need to require it like so

    require "active_record"
    

提交回复
热议问题