Forum: Ruby on Rails [ANN] ActiveRecord IO Mode Plugin

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
zdennis (Guest)
on 2006-04-21 01:58
(Received via mailing list)
Hash: SHA1

ActiveRecord IO Mode Plugin v.0.0.1
- -------------------------------------
We are pleased to announce the ActiveRecord IO Mode plugin version
0.0.1. It allows you to redirect where sql statements are sent.
By default they are sent to a database connection, with the IO Mode
plugin you can proxy them wherever you want. They can be sent
to any object that responds to the method <<

The link:

Once installed in the vendor/plugins directory you can test this by
running "ruby script/console" from the RAILS_ROOT, and doing something
similar to:

  # to redirect sql to an array
  >> arr = []
  >> ActiveRecord::Base.send_sql_to arr
  => true

  # let's test it
  >> Test.find :all, :limit => 1
  => []
  >> arr
  => ["SELECT * FROM tests LIMIT 1;\n"]

  # redirect sql back to our db connection
  >> ActiveRecord::Base.send_sql_to :db
  => true
  >> Test.find :all, :limit => 1
  =>  [#<Test:0x306daef0 @attributes={"name"=>"test1", "id"=>"1"}>]

Known Limitations
- -----------------
 - it works great with MySQL
 - it *should* work with PostgreSQL
 - it has *not* been tested on MSSQL, Oracle, SQLite, etc.

If you can provide feedback for using this with MySQL, MSQQL, Sqlite,
Oracle, PostgreSQL, that would be great!

Any feedback or suggestions are graciously accepted!


Zach D. & Mark Van H.
removed_email_address@domain.invalid     removed_email_address@domain.invalid

Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird -

This topic is locked and can not be replied to.