Yes, this can be achieved through redirecting rails log to standard output.
Write these at your console prompt:
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.connection_pool.clear_reloadable_connections!
Furthermore, you can put these lines in ~/.irbrc file, so that each time you don't need to manually write these 2 lines:
require 'rubygems'
if ENV.include?('RAILS_ENV') && ENV["RAILS_ENV"] == 'development'
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.connection_pool.clear_reloadable_connections!
end
Friday, November 2, 2012
Is there a way through which I see which mysql queries are fired from ActiveRecord in rails console?
http://stackoverflow.com/questions/4667316/how-to-see-mysql-queries-in-rails-console
Wednesday, August 22, 2012
Tuesday, August 14, 2012
Friday, August 10, 2012
VIM: Search And Replace Text In Multiple Files
:args **/*.* // set the pattern of file names to look at :argdo %s/search_for/replace_with/gecI | update
Sunday, May 20, 2012
Transfer Your Existing Git Repository to Github
$ git push --mirror git@github.com:username/project.git
Wednesday, May 9, 2012
Giganews Mimo Crashes After Splash Screen on Win 7
If you're crashing on the splash screen right after it the RMI initialization message try passing the -noRmi flag to mimo.exe. In the start menu right click on Mimo, select properties, and add the flag to the target. Mine looks like this:
"C:\Program Files (x86)\Mimo\Mimo.exe" -noRmiYou should see an "RMI Disabled" message on the splash screen.
Oracle, Ruby, RVM, and OSX Lion
As of this writing the x64 version of the Oracle Instant Client do NOT work with OSX Lion. I got everything working like so:
Install Oracle Instant Client
Install the 32 bit version of the Oracle Instant Client. Download and install the following packages to /usr/local/oracle/instantclient_10_2- instantclient-basic-10.2.0.4.0-macosx-x86.zip
- instantclient-sqlplus-10.2.0.4.0-macosx-x86.zip
- instantclient-sdk-10.2.0.4.0-macosx-x86.zip
Install the 32-bit version of Ruby
brew install libyaml
rvm install 1.9.3 -n i386 --with-arch=i386
rvm use ruby-1.9.3-p194-i386
Bash
Add the following to your .bash_profileexport DYLD_LIBRARY_PATH="/usr/local/oracle/instantclient_10_2" export TNS_ADMIN="/usr/local/oracle/network/admin/" export SQLPATH="/usr/local/oracle/instantclient_10_2" export ORACLE_HOME="/usr/local/oracle/instantclient_10_2" export NLS_LANG="AMERICAN_AMERICA.UTF8" export PATH="$PATH:/usr/local/bin/" export PATH="$PATH:/usr/local/oracle/instantclient_10_2"Open and use a new terminal going forward.
tnsnames.ora
Create a tnsnames.ora file here:/usr/local/oracle/network/admin/tnsnames.oraMine looks like this:
staging_db =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 123.456.789.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = FOO)
)
)
Try it
ruby -rubygems -e "require 'oci8'; OCI8.new('username','password','staging_db').exec('select * from users where rownum < 2') do |c| puts c.join(','); end;"
Subscribe to:
Posts (Atom)
