Rails 3: Render Production Errors in 1 Controller

We want to see errors in production only for our admin controllers.
In Rails 2 this was simple, but now we had to get hacky:

class AdminController < ApplicationController
  rescue_from Exception, :with => :render_simple_error if Rails.env.production?
  def render_simple_error(e)
    render :text => "#{e.message} -- #{e.class}<br/>#{e.backtrace.join("<br/>")}"
  end
end

Its not very pretty (session/params are missing), but solves our pain for now.

Getting back Panel icons (systray) in Natty

Lots of panel apps do not work with new natty ApplicationIndicators based panel, but you can manually whitelist them to work with the old system or just use them all 🙂

gsettings set com.canonical.Unity.Panel systray-whitelist "['all']"

After that restart/relogin they should show up.

in case you want to revert it, the default is “[‘JavaEmbeddedFrame’, ‘Mumble’, ‘Wine’, ‘Skype’, ‘hp-systray’, ‘scp-dbus-service’]”

Installing MySql Handlersocket in Ubuntu Natty for Ruby

Install

sudo apt-get install mysql-server -y;
sudo apt-get install handlersocket-doc -y;
sudo apt-get install handlersocket-mysql-5.1 -y;
sudo apt-get install libhsclient-dev -y;

Configure

#/etc/mysql/my.cnf -- under mysqld section
loose_handlersocket_port = 9998
loose_handlersocket_port_wr = 9999
loose_handlersocket_threads = 16
loose_handlersocket_threads_wr = 1
open_files_limit = 65535 

Start

mysql -e "install plugin handlersocket soname 'handlersocket.so';"
sudo /etc/init.d/mysql restart

# should show lots of handlersocket processes
mysql -e "show processlist;"

Use

gem install handlersocket

require 'handlersocket'
h = HandlerSocket.new(:host => '127.0.0.1', :port => '9998')

# open PRIMARY index on widgets.user table, assign it ID #1
h.open_index(1, 'widgets', 'user', 'PRIMARY', 'user_name,user_email,created')
...

more of this can be found at ruby handlersocket introduction and ActiveRecord Handlersocket gem