You can see a working version here: http://fancybox.heroku.com/ Download the code and look at the controller and the view. I already included all the necessary files.
csanz/csanz_fancy_box
I merged fancy box plugin with a full rails project and a form example
JavaScript