/ Published in: Rails

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# for rails 2 if ENV.include?('RAILS_ENV') if !Object.const_defined?('RAILS_DEFAULT_LOGGER') require 'logger' Object.const_set('RAILS_DEFAULT_LOGGER', Logger.new(STDOUT)) end def sql(query) ActiveRecord::Base.connection.select_all(query) end # for rails 3 elsif defined?(Rails) && !Rails.env.nil? if Rails.logger Rails.logger = Logger.new(STDOUT) ActiveRecord::Base.logger = Rails.logger end end
Comments
