我試圖建立一個簡單的ruby腳本,連接到數據庫並運行一些基本的查詢。Ruby Rake ActiveRecord Migrate
的代碼是在這裏:https://github.com/mastermindg/rack-activrecord-example
這不是一個服務 - 只是一個腳本,在手動運行做批處理作業。我的問題是我需要填充數據庫用於測試目的。我知道如何在西納特拉和Rails做到這一點,但它的失敗爲-是:
NoMethodError: undefined method `set' for main:Object
Did you mean? send
/usr/src/app/app.rb:7:in `<top (required)>'
/usr/src/app/Rakefile:2:in `<top (required)>'
我已經得到了database.yml的,但我不能告訴如何加載它,因爲集失敗。
如何使用ActiveRecord與基本Rack進行連接並查詢數據庫?