Forum: Ruby on Rails How to work with non-CRUD SQL statements?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
ghuntress (Guest)
on 2005-12-04 20:02
(Received via mailing list)
Hi,

I have a few database admin-related functions that I want to integrate
into a rails app.   Some specific MySQL commands are GRANT and REVOKE
that do not return a recordset, and "SHOW PROCESSLIST" which does return
a recordset but does not have an underlying table.

I started trying to do this by getting a new connection
ActiveRecord::Base.establish_connection() and working with that.  But
the only way I've gotten it to work is to supply new connection
credentials.  It's definitely not railsey to maintain connection info in
two places.

How can I make a second connnection to whichever db is active in
database.yml?  (ie development, test, production)

Is there a better way to execute something like "create database..." or
GRANT/REVOKE than making a second connection?

Thanks!

Gary H.
Pat M. (Guest)
on 2005-12-04 20:06
(Received via mailing list)
ActiveRecord::Base.connection
This topic is locked and can not be replied to.