<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: ActiveRecord Without Rails</title>
	<atom:link href="http://blog.aizatto.com/2007/05/21/activerecord-without-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.aizatto.com/2007/05/21/activerecord-without-rails/</link>
	<description>The best way to predict the future is to invent it</description>
	<lastBuildDate>Thu, 18 Mar 2010 00:51:32 +0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: mondher</title>
		<link>http://blog.aizatto.com/2007/05/21/activerecord-without-rails/comment-page-1/#comment-21662</link>
		<dc:creator>mondher</dc:creator>
		<pubDate>Mon, 09 Nov 2009 08:18:20 +0000</pubDate>
		<guid isPermaLink="false">http://rails.aizatto.com/2007/05/21/activerecord-without-rails/#comment-21662</guid>
		<description>Hi Aizat,

Thanks for this useful article.
I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module:
module SqlHunter
class ActiveRecord::ConnectionAdapters::AbstractAdapter

@@queries = []
cattr_accessor :queries
def log_info_with_trace(sql, name, runtime)
return unless @logger &amp;&amp; @logger.debug?
@@queries &lt;&lt; sql
end
alias_method_chain :log_info, :trace
end
end

in the controller I wrote that

sqlfile = File.open(&quot;public/advancedStats/#{@dir_name}/advancedStatQuery.sql&quot;, &#039;w&#039;)
@queries = ActiveRecord::ConnectionAdapters::AbstractAdapter::queries
for query in @queries do
sqlfile.write(&quot;#{query} \n&quot;)
end
sqlfile.close

I also modified Rails environment by adding this line:

ActiveRecord::Base.logger.level = Logger::DEBUG

This program is working and I can get queries but, all queries. In contrast I need only the specific queries done by one user to generate a stat report.

Do you have any idea to fix that,
Thanks,

mgatri</description>
		<content:encoded><![CDATA[<p>Hi Aizat,</p>
<p>Thanks for this useful article.<br />
I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module:<br />
module SqlHunter<br />
class ActiveRecord::ConnectionAdapters::AbstractAdapter</p>
<p>@@queries = []<br />
cattr_accessor :queries<br />
def log_info_with_trace(sql, name, runtime)<br />
return unless @logger &amp;&amp; @logger.debug?<br />
@@queries &lt;&lt; sql<br />
end<br />
alias_method_chain :log_info, :trace<br />
end<br />
end</p>
<p>in the controller I wrote that</p>
<p>sqlfile = File.open(&quot;public/advancedStats/#{@dir_name}/advancedStatQuery.sql&quot;, &#039;w&#039;)<br />
@queries = ActiveRecord::ConnectionAdapters::AbstractAdapter::queries<br />
for query in @queries do<br />
sqlfile.write(&quot;#{query} \n&quot;)<br />
end<br />
sqlfile.close</p>
<p>I also modified Rails environment by adding this line:</p>
<p>ActiveRecord::Base.logger.level = Logger::DEBUG</p>
<p>This program is working and I can get queries but, all queries. In contrast I need only the specific queries done by one user to generate a stat report.</p>
<p>Do you have any idea to fix that,<br />
Thanks,</p>
<p>mgatri</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: major_code (major_code)</title>
		<link>http://blog.aizatto.com/2007/05/21/activerecord-without-rails/comment-page-1/#comment-19331</link>
		<dc:creator>major_code (major_code)</dc:creator>
		<pubDate>Sun, 13 Sep 2009 01:05:16 +0000</pubDate>
		<guid isPermaLink="false">http://rails.aizatto.com/2007/05/21/activerecord-without-rails/#comment-19331</guid>
		<description>http://tinyurl.com/rbb8uc 
ActiveRecord Without Rails « Strange Symphonies</description>
		<content:encoded><![CDATA[<p><a href="http://tinyurl.com/rbb8uc" rel="nofollow">http://tinyurl.com/rbb8uc</a><br />
ActiveRecord Without Rails « Strange Symphonies</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Claudio</title>
		<link>http://blog.aizatto.com/2007/05/21/activerecord-without-rails/comment-page-1/#comment-19069</link>
		<dc:creator>Claudio</dc:creator>
		<pubDate>Sun, 06 Sep 2009 22:01:06 +0000</pubDate>
		<guid isPermaLink="false">http://rails.aizatto.com/2007/05/21/activerecord-without-rails/#comment-19069</guid>
		<description>I cant express the aewsome, thank you</description>
		<content:encoded><![CDATA[<p>I cant express the aewsome, thank you</p>
]]></content:encoded>
	</item>
</channel>
</rss>
