Posts Tagged "tips"

How to reduce your page loads from 72 seconds to 1.52 seconds

»Posted by on Jul 20, 2010 in Blog | 4 comments

If you’re expecting some kind of long winded tutorial about optmising, caching and super-charging your site, sorry to disappoint. The advice is: Don’t use flickr Ok, if you’re not a flickr user you’ve probably stopped reading already, but if not you might be rewarded by one or two nuggets of useful information. The story starts with Hiro’s personal blog being at the top of hatena’s bookmarks page (think Japanese delicious). Unfortunately, it was hosted in-house about 2 metres away from where I am sitting. I think I can still smell the smoke :p It was swamped, no-one could get through to it but we kept it up in some vain attempt to let whoever access the Evangelion related story. The server wasn’t tuned or optimised...

read more

[Ruby] HOW TO use multiple databases with ActiveRecord

»Posted by on Feb 16, 2009 in Blog | 6 comments

Sometimes you need to access multiple databases in one application. For example, using different application’s database.  But usually ActiveRecord is configured to ActiveRecord::Base directly, and so establishes a connection with ActiveRecord::Base, so you can’t use multiple database with AR. So how to do it? Just create sub-classes of ActiveRecord::Base. Sub-classes of ActiveRecord::Base can access parent class configurations and connections. So create a sub-class of ActiveRecord::Base BaseDB then set configurations to it.  Create sub-classes of BaseDB then establish database connection each of them. It’s better than to set configurations and establish connection on ActiveRecord::Base directly for future. ActiveRecord::Base BaseDB <...

read more