To stay on the safe side, FreshBooks decided to disguise the new Rails app to appear as though it was still the old PHP version. Thanks to Rails’ flexibility, this was surprisingly easy to achieve. The heart of the disguise is a single line added to a routes.rb file.
map.connect ‘:fake_filename.php’, :controller => ‘php’, :action => ‘dispatch’
This takes what appear to be requests for php files and sends them over to the PhpController controller. In the dispatch action, we lookup the “filename” that was requested and map it to an action and a controller to actually handle the request.
(Link: How FreshBooks secretly switched from php to rails)


April 2, 2009

No comments yet... Be the first to leave a reply!