Plugins - ActiveRecord IO Mode Plugin

StarAdd to favorites

Redirect the SQL statements that ActiveRecord generates to any object that responds to the method <<

Example:

# to redirect sql to an array

arr = [] ActiveRecord::Base.sendsqlto 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.sendsqlto :db => true Test.find :all, :limit => 1 => [#"test1", "id"=>"1"}>]

Authors: Mark VanHolstyn, Zach Dennis

Zach Dennis

http://www.mktec.com/oss/rails-plugins/

BSD-type

  • Currently 5.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Searching and Queries

Tags

Comments

Add a comment

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?