ActiveRecord IO Mode plugin

Plugin details

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

Websitehttp://www.mktec.com/oss/rails-plugins/ Author Mark VanHolstyn Tags ActiveRecord, io, sql LicenseMIT

Documentation

 # send sql statements to the database, this is default ActiveRecord behavior
 ActiveRecord::Base.send_sql_to :db
 
 # send sql statements to an Array
 arr = []
 ActiveRecord::Base.send_sql_to arr
	
 # send sql statements to a File
 f = File.new 'sql.out', 'w'
 ActiveRecord::Base.send_sql_to f
	
 # send sql statements to standard out
 ActiveRecord::Base.send_sql_to :stdout
	
 # send sql statements to standard error
 ActiveRecord::Base.send_sql_to :stderr
	
 # at any point to switch back to sending sql to the database 
 ActiveRecord::Base.send_sql_to :db


Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, 9 months ago