Is it possible to obtain details about a schema and get the table objects using a stand alone active record connection. I am trying to do something like this
require'rubygems'
gem 'activerecord'
require 'activerecord'
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:host => "localhost",
:username => "root",
:database => "test_database"
)
Is it possible to access the tables of the db using this connection object.
Yes, it is perfectly possible to use ActiveRecord without Rails.
You can also use standalone_migrations gem to manage ActiveRecord environment outside of Rails: https://github.com/thuss/standalone-migrations .
Have you try to load all Active Support?
In order to have a near-zero default footprint, Active Support does not load anything by default. It is broken in small pieces so that you can load just what you need
require 'active_support/all'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.