How FreshBooks secretly switched from php to rails

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)

Advertisement

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

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.