Gritter, jqModal, Chain, BlueTrip to be integrated into JPolite 2

After some investigation and tryout, I’ve decided to include cool iQuery plugins like Gritter, jqModal as well as Chain into JPolite 2, and some initial integration work have gone smoothly. And these libraries are actually jQuery plugins, that I think it good to build a mechanism for smooth integration of various plugins in a manageable manner.

BlueTrip CSS framework has been chosen as the foundation of CSS where I’ll leave the original framework code untouched and provide only JPolite native customizations. Although JPolite was originally designed without a grid system in mind, I’ll try to align with the grid system to provide better control over the layout.


InvalidAuthenticityToken error in cooked Ajax request with Rails 2.3.2

When moving an old Rails 2.2.2 based application to Rails 2.3.2 environment, I came across the InvalidAuthenticityToken error constantly in all Ajax form requests on all browser platforms. The settings were nothing special at all, a session_key with secret and a mere protect_from_forgery statement …

After numerous attempts it occurs to me that a few requests were successful at times. So after some look and search I realized that the algorithm of form_authenticity_token seems to have changed from Rails 2.2.2 that lots special characters like ‘/’, ‘+’, ‘=’ are included, e.g., “vfbzRs6tLb0xZ/cxaML85y+JODOE+P4klbzue0CIef8=” which I didn’t encode at all in the old code. Reverting back to Rails 2.2.2, I got my hypothesis confirmed, all authenticity_tokens use alphabetic and numeric letters, e.g., “757942043a3b2509365263ef66ff4589e61c2eaa”, no encoding necessary.

So after introducing the JavaScript encodeURIComponent function to encode the authenticity_token before sending out via Ajax, all InvalidAuthenticityToken errors fade away 🙂

A two-hours lesson!