DRYing up Flash Embedding

Thursday, February 26, 2009

Most of the Flash embedding I’ve done has involved passing in some dynamic variables to the flash. After trying a few different techniques for passing in those variables, I believe I found a solution I’m happy with. I use the jQuery SWFObject plugin, the jQuery Metadata plugin with JSON, and a small helper plugin to keep things DRY. jQuery SWFObject The jQuery SWFObject brings the awesomeness that is SWFObject to the “jQuery Way” of doing things. For example, to embed a simple Flash movie you…

Posted in jQuery, Ruby on Rails with 0 comments

Unobtrusive Destroy Links in Rails using jQuery

Wednesday, February 25, 2009

Rails has a few helpers that make creating RESTful action links, like a delete link, pretty easy. A delete action has to use a POST request which means it has to use a form or AJAX. To get around this Rails spits out some inline JavaScript that generates the form and submits it for you when you click the link in the browser. This means that the delete link requires JavaScript to work. This is becoming a typical requirement for web apps (possibly propagated by how simple Rails and similar framewo…

Posted in jQuery, Ruby on Rails with 12 comments

jQuery, Rails, and AJAX

Tuesday, February 24, 2009

On a recent Rails based project, cubeless, I was cleaning up some legacy code with the help of Burin. The project is large and has been through several Rails upgrades but wasn’t fully taking advantage of some of “newer” Rails best practices. The controllers were heavy with lots of inline RJS and actions that catered only to a particular JavaScript function. We set out to keep the JavaScript isolated to the public/javascripts folder and to use REST in conjunction with the respond_to method. Amo…

Posted in jQuery, Ruby on Rails with 4 comments