<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Darian Shimy &#187; console</title>
	<atom:link href="http://www.darianshimy.com/tag/console/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.darianshimy.com</link>
	<description></description>
	<lastBuildDate>Sat, 01 Oct 2011 06:06:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>SQL Logging to script/console</title>
		<link>http://www.darianshimy.com/2009/10/sql-logging-to-scriptconsole/</link>
		<comments>http://www.darianshimy.com/2009/10/sql-logging-to-scriptconsole/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 04:37:06 +0000</pubDate>
		<dc:creator>Darian Shimy</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[hirb]]></category>
		<category><![CDATA[irb]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.darianshimy.com/?p=437</guid>
		<description><![CDATA[When running a Rails console session, a true time saver is directing the ActiveRecord logs to STDOUT instead of the log file.  This is easily accomplished adding the following to your ~/.irbrc file: if rails_env = ENV&#91;'RAILS_ENV'&#93; # Called after &#8230; <a href="http://www.darianshimy.com/2009/10/sql-logging-to-scriptconsole/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When running a Rails console session, a true time saver is directing the ActiveRecord logs to STDOUT instead of the log file.  This is easily accomplished adding the following to your ~/.irbrc file:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">if</span> rails_env = ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'RAILS_ENV'</span><span style="color:#006600; font-weight:bold;">&#93;</span>
  <span style="color:#008000; font-style:italic;"># Called after the irb session is initialized and Rails has</span>
  <span style="color:#008000; font-style:italic;"># been loaded (props: Mike Clark).</span>
  IRB.<span style="color:#9900CC;">conf</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:IRB_RC</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#CC0066; font-weight:bold;">Proc</span>.<span style="color:#9900CC;">new</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>.<span style="color:#9900CC;">logger</span> = <span style="color:#CC00FF; font-weight:bold;">Logger</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>STDOUT<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>.<span style="color:#9900CC;">instance_eval</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#9966CC; font-weight:bold;">alias</span> :<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#ff3333; font-weight:bold;">:find</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>If someone knows the original author of these lines, let me know and I&#8217;ll give them proper attribution.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.darianshimy.com/2009/10/sql-logging-to-scriptconsole/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

