how to require active record working outside of rails
Here's how I'm using ActiveRecord outside of Rails:
#!/usr/bin/rubyrequire 'active_record'require 'mysql2' # or 'pg' or 'sqlite3'ActiveRecord::Base.establish_connection( adapter: 'mysql2', # or 'postgresql' or 'sqlite3' database: 'DB_NAME', username: 'DB_USER', password: 'DB_PASS', host: 'localhost')# Note that the corresponding table is 'orders'class Order < ActiveRecord::BaseendOrder.all.each do |o| puts "o: #{o.inspect}"end