Fault tolerant loading remote javascript with YUI

The registration form of the MyOwnDB app was simplified this week, but an information I wanted to keep is the country where registered people are located, notably to know which translation of the UI to provide next (currently, it looks like it will be spanish).

I decided to use the service, but it appears it's unreachable at this time, making for a less than engaging experience when loading the sign-up page.

Using rails' escape_javascript outside of views

Rails provides a handy function to escape string to be used in your javascript code. Unfortunately, it is only available in your views. It is very easy though to make it available outside of views, eg in your helpers, as it suffices to require and include one module:

require 'action_view/helpers/javascript_helper'
include ActionView::Helpers::JavaScriptHelper

# escape_javascript is available here.
Syndicate content